patch - Failing to update a Location using the Google My Business API -


for while i've been trying build working patch request updating location through googles business api, have yet make successful request.

this last attempt of request looks likes:

{   location": {     "primaryphone": "1-800-test"   },   "languagecode": "en",   "fieldmask": "primaryphone",   "validateonly": true } 

when omit fieldmask error saying address.country not set, present following error:

{   "error": {     "code": 400,     "message": "request contains invalid argument.",     "status": "invalid_argument"   } } 

not informative :p

any ideas doing wrong? have working sample request? (preferably 1 updates opening hours) :)

i wound here while looking example before making work. so, better late never, here working answer.

there distinction between fields describe how request should processed, , data goes location. former go after ? in url. latter goes body.

so should issue a:

patch https://mybusiness.googleapis.com/v3/accounts/$accountid/locations/$locationid?languagecode=en&fieldmask=primaryphone&validateonly=true 

with body of:

{"primaryphone":  "1-800-test"} 

assuming have valid authorization header, should work.


Comments