GMB 补丁本地帖子添加或删除图片

huangapple go评论63阅读模式
英文:

GMB Patch local post add or delete image

问题

我想要编辑(PATCH)本地帖子以添加/删除照片,如何更改数据/updateMask以一次添加多个媒体或删除其中一个?

文档链接
https://developers.google.com/my-business/reference/rest/v4/accounts.locations.localPosts/patch
https://developers.google.com/my-business/content/posts-data#edit_posts

我尝试将updateMask更改为media并发送包含所有媒体的数组,其中包括我的URL,但响应是BAD_REQUEST消息,太多照片。一个帖子最多只能有1张照片,但在Google上可以添加10张照片...

用于替换本地帖子中所有媒体的有效请求

PATCH https://mybusiness.googleapis.com/v4/accounts/*/locations/*/localPosts/*?updateMask=media.mediaFormat,media.sourceUrl
const payload = { media: [{ mediaFormat: "PHOTO", sourceUrl: "URL" }] }
英文:

I wanted to edit (PATCH) local posts add/delete photos
how change data/updateMask to add many media in one time or delete one of them?

links to docs
https://developers.google.com/my-business/reference/rest/v4/accounts.locations.localPosts/patch
https://developers.google.com/my-business/content/posts-data#edit_posts

i try change updateMask to media and send array of all media adding one with my URL but respond is BAD_REQUEST message Too many photos. A post may only have a maximum of 1 photos. but on google can add 10 pic...

Working request to replace all media in local post

PATCH https://mybusiness.googleapis.com/v4/accounts/*/locations/*/localPosts/*?updateMask=media.mediaFormat,media.sourceUrl
const payload = { media: [{ mediaFormat: "PHOTO", sourceUrl: "URL" }] }

答案1

得分: 2

我支持GMB写了一封信。对我们来说是个坏消息。以下是他们的回复:

不幸的是,Google Business Profile API目前不允许每篇帖子有多张照片。一篇帖子最多只能有1张照片。
当Google Business Profile API的任何更改或新功能可用时,我们将在Google Developers网站上宣布。

真诚地,Shalini

Google Business Profile API团队

英文:

I wrote in support of GMB. Bad news for us. Here is their response.

> Unfortunately, the Google Business Profile API doesn’t currently allow
> multiple photos per post. A post may only have a maximum of 1 photo.
> We’ll announce any changes or new features of the Google Business
> Profile API when they become available on the Google Developers site.
>
>
> Sincerely, Shalini
>
> The Google Business Profile API team

答案2

得分: 0

"media" 是数组类型,您只需向其添加更多元素。

"media": [
    {
      object (MediaItem)
    }
]

要更新整个数组,updateMask 应该只是 media

参考链接:
https://developers.google.com/my-business/reference/rest/v4/accounts.locations.localPosts#resource:-localpost

英文:

media is of type array, you can just add more elements to it.

"media": [
    {
      object (MediaItem)
    }
]

To update the whole array, the updateMask should just be media.

Reference:
https://developers.google.com/my-business/reference/rest/v4/accounts.locations.localPosts#resource:-localpost

huangapple
  • 本文由 发表于 2023年6月22日 15:47:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76529633.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定