GET/api/v4/locations/{locationId}/photos

获取地点的照片

返回附加到单个地点的所有媒体文件,包括已加星标和未加星标的照片。

需要 API 密钥。请求头格式和密钥轮换请参阅身份验证。

参数

路径

名称类型必填描述
locationIdstring必填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.
Response
{  "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"