GET
/api/v4/locations/{locationId}/photos取得地點的相片
傳回附加至單一地點的所有媒體檔案,包括已加星號和未加星號的相片。
參數
路徑
| 名稱 | 類型 | 必填 | 說明 |
|---|---|---|---|
| locationId | string | 必填 | The location's Base64-encoded Relay ID (for example `TG9jYXRpb246MTgwMDI4OQ==`). The raw numeric database ID (`1800289`) is also accepted, and so is a percent-encoded value such as `...%3D%3D`. |
回應
200Array of media files for the location. Returns an empty array when the location has no photos.
{ "data": { "mediaFilesOfLocation": [ { "id": "TWVkaWFGaWxlOjU4Nzg5MzE=", "url": "https://sy-media-store.s3-us-west-2.amazonaws.com/f868bb3f/59c670a3/f47d62a6.jpg", "thumbnailUrl": "https://sy-media-store.s3-us-west-2.amazonaws.com/f868bb3f/59c670a3/thumbnail_f47d62a6.jpg", "categoryName": "Logo", "categoryId": "4", "fileType": "image", "starred": false, "viewsCount": 0 }, { "id": "TWVkaWFGaWxlOjU4Nzg5MzI=", "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", "categoryName": "Additional", "categoryId": "12", "fileType": "image", "starred": true, "viewsCount": 143 } ] }}401Unauthenticated, missing or invalid API key.
429Rate limit exceeded. Retry after the `Retry-After` header value.
傳回附加至地點的每個媒體檔案:標誌、封面和額外圖片,並包含每個檔案的公開 url、thumbnailUrl、類別、是否為 starred,以及全期間的 viewsCount。
使用案例:呈現地點的相片集。擷取媒體清單,以顯示商家已上線的圖片,使用 thumbnailUrl 呈現格狀檢視,並使用 url 呈現原始尺寸檢視。starred 會告訴您哪些額外相片已釘選,以便在支援此功能的發布平台上優先顯示。
使用案例:上傳前檢查媒體是否齊全。先呼叫此端點,查看地點是否缺少 Logo 或 Cover 類別的圖片,然後僅上傳缺少的圖片。傳回的 id 值就是您要傳遞給加星號和移除端點的值。
注意事項。
- 任一種 id 形式都可用於路徑中:
1800289、TG9jYXRpb246MTgwMDI4OQ==和TG9jYXRpb246MTgwMDI4OQ%3D%3D都會解析為同一個地點。若值不屬於上述任一形式,則會傳回 HTTP 200,並附上包含SY90002: Invalid Id的errors陣列和null承載資料。 - 沒有媒體的地點會傳回
{ "data": { "mediaFilesOfLocation": [] } },這是「Jenny Home」等剛建立的地點實際收到的回應,並非錯誤。
Request
curl -X GET 'https://listingsapi.com/api/v4/locations/<locationId>/photos' \ -H "Authorization: API $LISTINGSAPI_KEY"