My Business
2.5K members online now
2.5K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

Is it possible to use javacsript client library for GMB?

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Can I load GMB and use it?

https://developers.google.com/api-client-library/javascript/reference/referencedocs

 

if not - is it possible to use the generic gapi.client.request

from the same client library (seems not due to different base domain)?

 

and if not - how should I properly pass the token?

currently using the fetch api and adding an header to the request:

key is: Authorization

value is concatenation of: 

gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().token_type
gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().access_token

 

which comes out something like: Bearer XXXX.YYYYYY

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Guy K
October 2016

Re: Is it possible to use javacsript client library for GMB?

Google Employee
# 2
Google Employee

Hi @Guy K,

 

The Google My Business API is not in the list of supported APIs and versions in the APIs Explorer for the Google API Client Library for JavaScript. Therefore, you may not be able to use the Google API Client Library for JavaScript entirely for the Google My Business API, and you should find help on its Support page.

 

If you’ve managed to successfully obtain an access token for making requests via the Google My Business API, you can send the access token to the API in an HTTP authorization header such as the following sample request message for listing all accounts including the request line and request header fields:

GET /v3/accounts HTTP/1.1
Host: mybusiness.googleapis.com
Content-length: 0
Authorization: Bearer <YOUR_ACCESS_TOKEN>

 

Please check out the Using OAuth 2.0 for Client-side Web Applications page for more support.

 

Thanks,

Terry

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Guy K
October 2016

Re: Is it possible to use javacsript client library for GMB?

Google Employee
# 2
Google Employee

Hi @Guy K,

 

The Google My Business API is not in the list of supported APIs and versions in the APIs Explorer for the Google API Client Library for JavaScript. Therefore, you may not be able to use the Google API Client Library for JavaScript entirely for the Google My Business API, and you should find help on its Support page.

 

If you’ve managed to successfully obtain an access token for making requests via the Google My Business API, you can send the access token to the API in an HTTP authorization header such as the following sample request message for listing all accounts including the request line and request header fields:

GET /v3/accounts HTTP/1.1
Host: mybusiness.googleapis.com
Content-length: 0
Authorization: Bearer <YOUR_ACCESS_TOKEN>

 

Please check out the Using OAuth 2.0 for Client-side Web Applications page for more support.

 

Thanks,

Terry