GoogleWebComponents / google-apis

Web components for loading Google's JavaScript Libraries
https://elements.polymer-project.org/elements/google-apis
Other
87 stars 64 forks source link

Trouble using custom API endpoints #62

Closed fwal closed 8 years ago

fwal commented 8 years ago

Hi!

After a quick test It seems like the support for using custom api endpoints isn't working using the apiRoot property.

The problem may be that the apiRoot property might not be recognised by gapi (or is the root param undocumented? https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiclientloadname--------version-callback) as it looks like it's searching the global domain.

The code:

<google-client-loader id="api" name="test" version="v1" apiRoot="http://localhost:8080/_ah/api"></google-client-loader>

The response:

{"error":{"errors":[{"domain":"global","reason":"notFound","message":"Not Found"}],"code":404,"message":"Not Found"}}

[update] Right now I've pinpointed the problem to the apiRoot property not being set via the attribute. The apiRoot attribute is picked up and the value resides inside this.attributes['apiroot'] but this.apiRoot (on line 212 in google-client-loader.html) is undefined thus causing it to fail.

fwal commented 8 years ago

I realised that this might very well be an issue with the backend sdk, I'm looking into it... https://github.com/google/google-api-javascript-client/issues/175

fwal commented 8 years ago

Well... Realised that I've not formatted the attributes correctly (I wrote apiRoot= rather than api-root=)

All is good :+1: