I want send a HashMap
from JS application to my Google App. I created a HashMapContainer
class such as in : Cloud Endpoints C
Google Cloud Enpoints documentation says:
@Named: This annotation indicates the name of the parameter in the request that gets injected here. A parameter that is not annotated with @Named is injected with the whole request object.
Basically, as far as I understand, when you add @Named
annotation, the parameters will be included at the end of the request URL:
http://end_point_url?parameter1=xxx¶meter2=yyy
Obviously the parameter types that support @Named
annotation are only a few (int, long, String, Boolean and their correspondent arrays, I think), because you can't append a whole hashmap to the request URL!
On the other hand, if you don't use @Named
, the parameter will be included (injected) within the POST data.
In order to send a parameter within the HTTP body using the Google APIs Client Library for JavaScript, you just have to include that parameter into an object called resource
inside the JSON-RPC request, like this:
var req = gapi.client.myApi.endpoint.myMethod({
'param1': 'FOO',
'resource': {
'param2': {
'value1':'foofoo',
'value2':'barbar',
'value3':'foobar'
}
}
});
The API client will automatically send param1
in the URL and param2
in the POST data...
This is explained in detail in this section of the Google APIs Client Library for JavaScript documentation.