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

accounts.updateNotifications help PHP

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

Hello,

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 https://mybusiness.googleapis.com/v3/accounts/*/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] => https://mybusiness.googleapis.com
    [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
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
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:

projects/myproject/topics/mytopic

 

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.

 

Thanks,

Terry

View solution in original post

Marked as Best Answer.
Solution
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:

projects/myproject/topics/mytopic

 

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.

 

Thanks,

Terry

accounts.updateNotifications help PHP

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

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