php-google-my-business
php-google-my-business copied to clipboard
How to edit and delete any post from Google My Business
Kindly provide examples of edit and delete the post from Google My Business
what's wrong in below code
`$name_post = "accounts/xxxx/locations/xxxx/localPosts/xxxx"; $post_body = new \Google_Service_MyBusiness_LocalPost; $post_body->setLanguageCode('en'); $post_body->setSummary('test_new'); // post text $call = new \Google_Service_MyBusiness_CallToAction; $call->setActionType('LEARN_MORE'); $call->setUrl('https://www.xyz.net/'); // URL to link to $post_body->setCallToAction($call); $media = new \Google_Service_MyBusiness_MediaItem; $media->setMediaFormat('PHOTO'); $media->setSourceUrl('https://www.xyz.net/modules/images/home.jpg'); $post_body->setMedia($media); try {
$resp = $mybusinessService->accounts_locations_localPosts->patch($name_post, $post_body);
var_dump($resp);
die;
} catch (\Google_Service_Exception $e) { print_r($e); }`
getting error message
"error": { "code": 400, "message": "Request contains an invalid argument.", "errors": [ { "message": "Request contains an invalid argument.", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" }