【问题标题】:Create Local post on Google My Business Issue在 Google 我的商家问题上创建本地帖子
【发布时间】:2020-03-07 09:57:48
【问题描述】:

尝试使用 My Business API 和 PHP 创建 Google My Business Local Post。 除了将 mediaItem 对象添加到帖子正文时,可以很好地创建本地帖子。 得到错误: { “错误”: { “代码”:400, "message": "请求包含无效参数。", “错误”:[{ "message": "请求包含无效参数。", “域”:“全球”, “原因”:“错误请求” }], “状态”:“INVALID_ARGUMENT” } }

    Below is the post object with mediaItem that is being sent to localPosts->create

    $new_post = new Google_Service_MyBusiness_LocalPost();
    $new_post->setSummary('Hello World');
    $new_post->setLanguageCode('en-US');    
    $media = new Google_Service_MyBusiness_MediaItem();
    $media->setMediaFormat("PHOTO");
    $media->setSourceUrl("https://www.webyhub.com/img/logo.png");
    $new_post->setMedia($media); 

【问题讨论】:

  • 这不是 codeigniter 问题,您应该询问 google 业务问题,请参阅此处stackoverflow.com/questions/47766904/…
  • 我在这里做错了什么。图片未在上述代码中发布。请帮我解决这个问题。

标签: php google-api


【解决方案1】:

您需要在 Postman 上执行此操作,以获取有关您使用的图像为何无效的详细验证消息。

尝试 Advanced Rest Client(或 Postman),使用
https://mybusiness.googleapis.com/v4/accounts/{uuid}/locations/{uuid}/localPosts 发出 POST 请求 标头:授权:承载 {access_token}。
正文内容类型:application/json
正文:

{
  "summary":"test",
  "topicType":"STANDARD",
  "media":[{"mediaFormat": "PHOTO","sourceUrl": "https://example.com/files/test.jpg"}]
}

此外,目前还无法使用上传视频创建帖子。我不知道为什么,但我也被这件事困住了。

【讨论】:

    猜你喜欢
    • 2022-11-10
    • 1970-01-01
    • 1970-01-01
    • 2020-02-24
    • 2014-05-05
    • 2014-05-25
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    相关资源
    最近更新 更多