Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to edit and delete any post from Google My Business #20

Open
dhirendralab opened this issue Sep 16, 2020 · 1 comment
Open

How to edit and delete any post from Google My Business #20

dhirendralab opened this issue Sep 16, 2020 · 1 comment

Comments

@dhirendralab
Copy link

Kindly provide examples of edit and delete the post from Google My Business

@dhirendralab
Copy link
Author

dhirendralab commented Sep 17, 2020

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" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant