NodeJS driver for the GMB API.
npm install google_my_business
var GMB = require('google_my_business')
GMB.options({version: 'v3'});
GMB.setAccessToken('access_token');
GMB.api('accounts', 'get', {}, function (res) {
if(!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
console.log(res);
});
var GMB = require('google_my_business')
var postData = {
"storeCode": "GOOG-SYD",
"locationName": "Google Sydney",
"primaryPhone": "(02) 1234 5678",
"address": {
"addressLines": [
"Level 5",
"48 Pirrama Road"
],
"locality": "Pyrmont",
"postalCode": "2009",
"administrativeArea": "NSW",
"country": "AU"
},
"latlng": {
"latitude": -33.869546,
"longitude": 151.194540
},
"websiteUrl": "https://www.google.com.au/",
"primaryCategory": {
"name": "Software Company",
"categoryId": "gcid:software_company"
},
"regularHours": {
"periods": [
{
"openDay": "SUNDAY",
"closeDay": "SUNDAY",
"openTime": "10:00",
"closeTime": "22:00"
},
{
"openDay": "MONDAY",
"closeDay": "MONDAY",
"openTime": "10:00",
"closeTime": "22:00"
},
{
"openDay": "TUESDAY",
"closeDay": "TUESDAY",
"openTime": "10:00",
"closeTime": "22:00"
},
{
"openDay": "WEDNESDAY",
"closeDay": "WEDNESDAY",
"openTime": "10:00",
"closeTime": "22:00"
},
{
"openDay": "THURSDAY",
"closeDay": "THURSDAY",
"openTime": "10:00",
"closeTime": "22:00"
},
{
"openDay": "FRIDAY",
"closeDay": "FRIDAY",
"openTime": "10:00",
"closeTime": "22:00"
},
{
"openDay": "SATURDAY",
"closeDay": "SATURDAY",
"openTime": "10:00",
"closeTime": "22:00"
}
]
}
};
GMB.options({version: 'v3'});
GMB.setAccessToken('access_token');
GMB.api(
'accounts/XXXXXXXXXXXXXXXXXXXXX/locations?languageCode=en&validateOnly=true&requestId=da822c46-ce15-4aaf-b385-59860ea75eb4',
'post',
postData,
function(res) {
if(!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
console.log(res);
}
);
- You can find more informations on the Google My Business developer website.
- You can find more informations on the YouTube.COM website.
- If you have any questions or remark, feel free to contact us at
[email protected]
Distributed under the MIT License.