Hi,

I have a  web application which calls several AppEngine Endpoints with the 
Google API JavaScript client library.

I am currently changing this application from callback mode to promises 
mode, as recommended by Google 
(https://developers.google.com/api-client-library/javascript/features/promises#using-promises)
 
and I am encountering a problem. Note that the app works well with the 
callback mode.

My problem with the promises mode is to find what is the correct path 
argument to use when calling the request method:

JavaScrit code:

var params = {'webSafeKeyParent’: 
‘neN4fm15xW52b2ljZXMtb19saW5lmlYLEglBY1NFwpRpdHkYgICAgQj97AoM’};
gapi.client.request({
    'path': 
'https://myappenginename.appspot.com/_ah/api/customerApi/v1/?????????',
    'params': params
    }).then(function(response) {
            // Handle response        
}, function(reason) {
            // Handle error
});

Endpoint definition in "customerApi":

@ApiMethod(
        name = "listByParent",
        path = "customerByParent/{webSafeKeyParent}",
        httpMethod = ApiMethod.HttpMethod.GET,
        scopes = {Constants.EMAIL_SCOPE},
        clientIds = {Constants.WEB_CLIENT_ID, 
com.google.api.server.spi.Constant.API_EXPLORER_CLIENT_ID},
        audiences = {Constants.ANDROID_AUDIENCE})
public List<Customer> listByParent(final User user, @Named("webSafeKeyParent") 
final String webSafeKeyParent, @Nullable @Named("cursor") String cursor, 
@Nullable @Named("limit") Integer limit) throws UnauthorizedException {


For few of my endpoints it works by including in the path argument of the 
JavaScript request method, the values of "path" and "name" as declared in 
the @ApiMethod annotation.

i.e. for the above endpoint, the following path works:
https://myappenginename.appspot.com/_ah/api/customerApi/v1/customerByParent/
listByParent

Strangely enough this does NOT work for some other endpoints of the same 
kind. 

I've also tried with the paths displayed under "Request" when you query the 
endpoints with the APIs Explorer but without success....

Is there any detailed documentation for calling AppEngine endpoints with 
promises? I have not found any. Do you have some advice to share please?

Thanks in advance,
Renaud

PS: I've published the same post in the "Google API JavaScript Client" group





-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/e9a505e6-c3ee-4568-8b58-4f3083dc348e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to