POST/api/v4/locations/photos/star

為地點相片加上星號

將地點的 1 張或多張額外相片標示為最愛,以便在支援的發布平台上優先顯示。

需要 API 金鑰。標頭格式與金鑰輪替請參閱驗證。

參數

請求主體

名稱類型必填說明
input.locationIdstring必填The location's Base64-encoded Relay ID the photos belong to.
input.photoIdsarray of strings必填Media file IDs to star (as returned by the get-photos or upload endpoints).
input.starredboolean必填`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 與值換成您自己的。

Request body
{  "input": {    "locationId": "TG9jYXRpb246MTgwMDI4OQ==",    "photoIds": [      "TWVkaWFGaWxlOjU4Nzg5MzI="    ],    "starred": true  }}

回應

200Photos starred. Returns each affected photo with `starred` set to true; `error` is null on success.
Response
{  "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    }  }'