POST
/api/v4/locations/photos/star为地点照片加星标
将地点的一张或多张附加照片标记为收藏,以便在支持此功能的发布平台上优先展示。
参数
请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| input.locationId | string | 必填 | The location's Base64-encoded Relay ID the photos belong to. |
| input.photoIds | array of strings | 必填 | Media file IDs to star (as returned by the get-photos or upload endpoints). |
| input.starred | boolean | 必填 | `true` to star the given photos, `false` to unstar them. This flag, not the path, decides what happens: `/star` and `/unstar` behave the same way. |
请求示例
可直接粘贴的请求体。请将占位 ID 和值替换为您自己的。
{ "input": { "locationId": "TG9jYXRpb246MTgwMDI4OQ==", "photoIds": [ "TWVkaWFGaWxlOjU4Nzg5MzI=" ], "starred": true }}响应
200Photos starred. Returns each affected photo with `starred` set to true; `error` is null on success.
{ "data": { "starUnstarLocationPhotos": { "success": true, "photos": [ { "id": "TWVkaWFGaWxlOjU4Nzg5MzI=", "databaseId": 5878932, "url": "https://sy-media-store.s3-us-west-2.amazonaws.com/f868bb3f/59c670a3/ef4ffb12.jpg", "thumbnailUrl": "https://sy-media-store.s3-us-west-2.amazonaws.com/f868bb3f/59c670a3/thumbnail_ef4ffb12.jpg", "type": "ADDITIONAL", "starred": true } ], "error": null } }}401Unauthenticated, missing or invalid API key.
为地点的指定照片加星标。在支持精选图片的发布平台目录中,加星标的照片会优先展示,因此您可以通过此方式将最佳照片置于商家信息顶部。
使用场景:突出展示季节性主图。上传新的店面照片后,为其加星标,使其在 Google 和其他支持此功能的网站上位于图库首位。在 photoIds 中传入上传响应中的媒体 ID。
使用场景:精选一致的品牌图片集。管理多个地点时,为每个地点的同一类附加照片(例如外观照片)加星标,以保持面向公众的图库一致。
注意事项。
- 响应以
starUnstarLocationPhotos为键,而不是以路由命名,并且/locations/photos/star和/locations/photos/unstar使用相同的键。 - 其载荷包含单个
error对象,而不是errors数组,并且没有clientMutationId。照片也没有caption字段。 - 只有
ADDITIONAL类别的照片可以加星标。LOGO和COVER图片已经是主图,无法加星标。 - 一个地点最多可以有 4 张加星标的照片;超出此限制会导致操作失败,并返回
SY15012。此检查会合计已加星标的照片和本次请求中的照片数量,并且仅在starred为true时适用。 - 要撤销此操作,请使用
starred: false执行POST /api/v4/locations/photos/unstar。决定操作结果的是starred的值,而不是路径:向/unstar提交starred: true会为照片加星标。
Request
curl -X POST 'https://listingsapi.com/api/v4/locations/photos/star' \ -H "Authorization: API $LISTINGSAPI_KEY" \ -H 'Content-Type: application/json' \ -d '{ "input": { "locationId": "TG9jYXRpb246MTgwMDI4OQ==", "photoIds": [ "TWVkaWFGaWxlOjU4Nzg5MzI=" ], "starred": true } }'