Unfortunately, this is not well documented, with the exception of some small references, for example. here
Usually API methods are called favorite:
gapi.client.myapi.myresource.mymethod(params)
params is a JSON object that includes all request parameters and paths, as well as resource , which will be sent as a body in a POST request.
Actually in the above example, they send the outcome as a request parameter as a POST request to tictactoe\v1\scores?outcome=WON with an empty body. This works because cloud endpoints do not affect the merging of the request object with the body and request parameters and URLs. This works in this case, but will not work as soon as you nest JSON objects inside the request body.
The correct way to call the method above:
gapi.client.tictactoe.scores.insert({ 'resource': {'outcome': 'WON'} })
If you have query parameters and URLs, it will look like this:
gapi.client.myapi.myresource.mymethod({ 'param1': 'value1', 'param2': 'value2', 'resource': body })
where body can be any JSON object. Or for methods that don't need a body, you just have
gapi.client.myapi.myresource.mymethod({ 'param1': 'value1', 'param2': 'value2' })
source share