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

accounts.updateNotifications help PHP

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


I'm trying to set up the push notifications service with the api. I got stuck  with this error: 'Google_Service_Exception [ 400 ]: Error calling PUT*/notifications: (400) Request contains an invalid argument.'

this is the request object:

Google_Http_Request Object
    [batchHeaders:Google_Http_Request:private] => Array
            [Content-Type] => application/http
            [Content-Transfer-Encoding] => binary
            [MIME-Version] => 1.0

    [queryParams:protected] => Array

    [requestMethod:protected] => PUT
    [requestHeaders:protected] => Array
            [content-type] => application/json; charset=UTF-8
            [x-goog-api-format-version] => 2
            [authorization] => Bearer *************************

    [baseComponent:protected] =>
    [path:protected] => /v3/accounts/*/notifications
    [postBody:protected] => {"topicName":"gmb-notifications"}
    [userAgent:protected] => 
    [canGzip:protected] => 
    [responseHttpCode:protected] => 
    [responseHeaders:protected] => 
    [responseBody:protected] => 
    [expectedClass:protected] => Google_Service_Mybusiness_Notifications
    [expectedRaw:protected] => 
    [accessKey] => 

I suppose the topicName must be set in a different format but i failed at finding the correct one. Any clue about what am i missing would be appreciated.


1 Expert replyverified_user
Marked as Best Answer.
Accepted by topic author Peter P
October 2016

Re: accounts.updateNotifications help PHP

[ Edited ]
Google Employee
# 2
Google Employee

Hi @Peter P,


Please navigate to the Pub/Sub topics page in the Cloud Platform Console to make sure that you have Created a topic, Given it publish permissions, Created a subscription and Specified push or pull delivery flow. Please note that you can perform these aforementioned operations not only through sending requests, but also manually through the Cloud Platform Console UI.


According to the Publisher Guide, a topic you create is supposed to be in this format:



Please note that the “myproject” placeholder for the topic shown above should be the Project ID of your whitelisted project. Please use the correct format shown above for the topicName field of the Notifications object when sending the PUT request for updating the Google Cloud Pub/Sub notification settings. Please make sure that the * in the URI of this PUT request from your source code is set to the account_name of the specified account.




accounts.updateNotifications help PHP

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks, works fine with the: `projects/myproject/topics/mytopic` format.