如何解决如何使用GMB API通过媒体制作localPost?
我可以使用GMB
api进行localPost。
错误如下。
{
"error": {
"code": 400,"message": "Request contains an invalid argument.","errors": [
{
"message": "Request contains an invalid argument.","domain": "global","reason": "badRequest"
}
],"status": "INVALID_ARGUMENT"
}
}
我的源代码如下。 另外,我从github安装了google / apiclient,并从here
安装了GMB库。$mediaItem = new \Google_Service_MyBusiness_MediaItem();
$mediaItem->setSourceUrl("https://example.com/test");
$mediaItem->setMediaFormat('PHOTO');
$media[] = $mediaItem;
$post = new \Google_Service_MyBusiness_LocalPost();
$post->setSummary($summary);
$post->setCallToAction($callToAction);
$post->setMedia($media);
$obj = new \Google_Service_MyBusiness($client);
$obj->accounts_locations_localPosts->create($accountLocation,$post);
如果我注释掉
"$post->setMedia($media);",I can make localPost.
您对此有何建议?
最诚挚的问候,
解决方法
我解决了自己。
Before:
$mediaItem->setSourceUrl("https://example.com/test");
After:
$mediaItem->setSourceUrl("https://example.com/test.jpg");
之所以不能进行localPost,是因为图像扩展名应该是图像扩展名。 Google API不允许我们发布没有扩展名的图像。
干杯。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。