POST
/api/v4/locations/photos/star為地點相片加上星號
將地點的 1 張或多張額外相片標示為最愛,以便在支援的發布平台上優先顯示。
參數
請求主體
| 名稱 | 類型 | 必填 | 說明 |
|---|---|---|---|
| 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時適用。 - 若要復原此操作,請執行
POST /api/v4/locations/photos/unstar,並傳入starred: false。決定操作結果的是starred的值,而非路徑:將starred: true提交至/unstar會為相片加上星號。
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 } }'