def _call_resource_method(self, cls, id, method_name, data):
if cls.api_root != "<STR_LIT:a>":<EOL><INDENT>url_path = "<STR_LIT>".format(<EOL>name=cls.collection_name, id=id, method=method_name<EOL>)<EOL><DEDENT>else:<EOL><INDENT>url_path = "<STR_LIT>".format(<EOL>app_id=self.app_id, name=cls.collection_name, id=id, method=method_name<EOL>)<EOL><DEDENT>url = URLObject(self.api_server).with_path(url_path)<EOL>converted_data = convert_datetimes_to_timestamps(data, cls.datetime_attrs)<EOL>session = self._get_http_session(cls.api_root)<EOL>response = session.post(url, json=converted_data)<EOL>result = _validate(response).json()<EOL>return cls.create(self, **result)<EOL>
POST a dictionary to an API method,
        for example /a/.../accounts/id/upgrade