GET
/api/v4/locations/{locationId}/posts获取地点的帖子
返回一页面向单个地点的社交帖子营销活动(公告、活动、优惠)。
参数
路径
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| locationId | string | 必填 | Base64-encoded location cursor / global ID (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). Pass it unchanged, do not URL-encode it. The base64 cursor always resolves; the raw numeric database ID also works on this endpoint, but the base64 form is the portable choice across the API. |
查询
| 名称 | 类型 | 必填 | 描述 | 默认值 |
|---|---|---|---|---|
| page | integer | 可选 | 1-based page number for offset pagination. | 1 |
| perPage | integer | 可选 | Number of records per page. Must not exceed 50. | 10 |
响应
200A page of post campaigns for the location, under `data.postsByLocation`. `records` is empty when the location has no posts yet.
{ "data": { "postsByLocation": { "records": [ { "id": "U29jaWFsUG9zdDo0NDEyMg==", "name": "Summer Hours Update", "status": "SUCCESS", "type": "ANNOUNCEMENT", "createdAt": "2026-06-28", "scheduledStartDate": "2026-06-28", "scheduledEndDate": "2026-07-28", "views": 128, "clicks": 14, "shares": 0, "reactions": 3, "comments": 1, "sites": ["GOOGLE"], "message": [ { "site": "GOOGLE", "message": "We have extended our summer hours! Open until 9pm on weekdays." } ], "cta": [ { "type": { "value": "LEARN_MORE", "label": "Learn more" }, "url": "https://jennyhome.example/hours", "site": "GOOGLE", "tinyUrl": "https://tiny.cc/jh-hours" } ], "contextInfo": null, "mediaUrl": [ { "url": "https://cdn.listingsapi.com/posts/44122/summer.jpg", "site": "GOOGLE", "type": "IMAGE" } ], "publishDetails": [ { "site": "GOOGLE", "status": "PUBLISHED", "createdDate": "2026-06-28", "publishedDate": "2026-06-28", "submissionError": null } ], "postLinks": [ { "site": "GOOGLE", "link": "https://www.google.com/maps/place/?post=44122" } ], "locationIds": [1800289], "clientName": "Jenny Home" } ], "locationDetails": [ { "id": "TG9jYXRpb246MTgwMDI4OQ==", "name": "Jenny Home", "street": "600 Congress Ave, Suite 200", "city": "Austin", "postalCode": "78701", "countryIso": "US", "stateIso": "TX", "stateName": "Texas", "storeId": null } ], "pageInfo": { "totalPages": 1, "hasNextPage": false, "hasPreviousPage": false, "totalRecords": 1 } } }}401Unauthenticated, missing or invalid API key.
429Rate limit exceeded. Retry after the `Retry-After` header value.
使用此端点可检索单个门店的帖子历史记录,其中包含涵盖该地点的每项公告、活动和优惠营销活动,以及各项营销活动的生命周期 status 和各帖子的互动计数(views、clicks、reactions)。
使用场景:创建营销活动前先检查。在为 Jenny Home 安排新的 Google 帖子之前,调用 GET /locations/TG9jYXRpb246MTgwMDI4OQ==/posts,查看哪些帖子已上线、哪些帖子仍处于 SCHEDULED 状态,以及上一则公告的表现。读取每条记录中的 type,筛选出优惠;此端点不支持服务端类型筛选。
注意事项。
- 此端点仅接受
page和perPage参数。此处没有filters、sortFields、locationIds或componentIdentifier参数(这些参数属于 bulk-posts 端点),传入其中任何一个参数都会被忽略,而不会被拒绝。请在您自己的代码中筛选和排序返回的records。 - 此路由会直接拒绝
tag,并返回tag is not a supported parameter for this query。当您需要根据标签解析出一组地点时,请使用 bulk-posts 端点。 perPage的上限为 50;值大于此上限时,请求会失败并返回per_page must not exceed 50。- 请严格按照列表/搜索端点返回的原始形式,将
locationId作为 base64 游标(例如TG9jYXRpb246MTgwMDI4OQ==)传入,不要对其进行 URL 编码。 - 分页基于偏移量:使用
page和perPage(默认值为 10),并读取pageInfo.totalPages/pageInfo.totalRecords以确定何时停止。 - 持续轮询可能触及账户速率限制(HTTP 429);请遵循
Retry-After响应头。
上方示例中的 records 数组仅作示意。线上的示例地点(Jenny Home)目前没有社交帖子,因此实际调用会返回 records: [] 和 pageInfo.totalRecords: 0。
相关操作:使用 POST /posts 创建帖子,使用 GET /posts/{postId} 获取单项营销活动,或使用 GET /locations/{locationId}/bulk-posts 列出批量(多地点)营销活动,后者支持 filters 和 sortFields,并在 rollupSocialPosts 下返回结果。
Request
curl -X GET 'https://listingsapi.com/api/v4/locations/<locationId>/posts' \ -H "Authorization: API $LISTINGSAPI_KEY"