【发布时间】:2018-09-15 10:35:16
【问题描述】:
我需要使用 google 客户端 api 创建一个本地主机。我编写了以下代码来创建本地帖子。
$service = new Google_Service_MyBusiness($client);
$callToAction = new Google_Service_MyBusiness_CallToAction();
$callToAction->setActionType('LEARN_MORE');
$callToAction->setUrl('localhost.com');
$mediaItem = new Google_Service_MyBusiness_MediaItem();
$mediaItem->setMediaFormat('PHOTO');
$mediaItem->setSourceUrl('https://www.theanthem.com/images/usps_eddm_postcards.jpg');
$localPost = new Google_Service_MyBusiness_LocalPost();
$localPost->setLanguageCode('en-US');
$localPost->setSummary('Just a summary');
$localPost->setCallToAction($callToAction);
$localPost->setMedia($mediaItem);
$parent = sprintf('accounts/%d/locations/%d',
'116633170334837786295',
'8830395735149945322'
);
$service->accounts_locations_localPosts->create($parent, $localPost);
但不幸的是,我遇到了以下错误。
我的错误:消息:调用 POST 时出错 https://mybusiness.googleapis.com/v4/accounts/9223372036854775807/locations/8830395735149945322/localPosts: (400) 请求包含无效参数。
我该如何解决这个问题?
【问题讨论】:
标签: php google-api google-api-php-client