评价
每个评价端点均提供 cURL、Python 和 Node 示例:来源与设置、列表、汇总、详情、回复、编辑、归档、短语和分析。
评价是客户在 Google、Facebook 和 Yelp 上留下的星级评分和评论。API 存储每条评价的一个副本,让您能够回复,并计算评价分析数据。REST 路径使用 reviews;响应键和参考页面标题使用 interactions,这是同一对象以前的内部名称。本指南始终使用“评价”这一名称。读取操作需要 Read(读取)密钥。回复、编辑、归档和更改设置需要 Write(写入)密钥;使用 Read 密钥执行写入操作会返回 400,并附带 SY90016。
端点概览
列出您的套餐允许使用的评价来源
GET /reviews/site-config 返回账户有权使用的评价平台目录。它不接受任何参数,且作用域为整个账户,因此请缓存结果,而不是针对每个地点调用。siteUrl 的值是此资源中所有其他筛选器接受的主机名。
curl https://listingsapi.com/api/v4/reviews/site-config \-H "Authorization: API $LISTINGSAPI_KEY"{ "data": { "interactionSiteConfig": [ { "site": "Google", "siteUrl": "maps.google.com" }, { "site": "Facebook", "siteUrl": "facebook.com" }, { "site": "Yelp", "siteUrl": "yelp.com" } ] }}读取 data.interactionSiteConfig[]。此示例使用 Launch 套餐账户;具体集合取决于套餐和行业。请将 siteUrl 用于列表端点的 siteUrls 筛选器,以及编辑设置时的 siteUrls[].name。
列出为地点配置的来源
GET /locations/{locationId}/reviews/settings 为套餐支持的每个平台返回一个条目,其中包含拉取评价所用的 URL。它用于读取下方编辑端点所修改的数据。路径接受 base64 id 或普通数字。
curl https://listingsapi.com/api/v4/locations/TG9jYXRpb246MTgwMDI4OQ==/reviews/settings \-H "Authorization: API $LISTINGSAPI_KEY"{ "data": { "interactionsSetting": { "siteSettings": [ { "name": "maps.google.com", "url": null }, { "name": "facebook.com", "url": null }, { "name": "yelp.com", "url": null } ] } }}读取 data.interactionsSetting.siteSettings[]。非 null 的 url 表示平台已连接,且正在从该页面拉取评价。值为 null 的 url 表示平台可用但尚未配置。当您通过 OAuth 连接 Google 和 Facebook 账号时,它们会自动填入,且无法通过编辑端点覆盖。Yelp 必须显式指定。
编辑地点的评价设置
POST /locations/reviews/settings/edit 设置要监测地点的哪些来源,以及被视为正面评价的星级评分。字段直接放在请求体中,而不是放在 input 封装对象中。添加来源会将抓取任务加入队列,因此新网站的评价会稍后传入,不会包含在此次响应中。
curl -X POST https://listingsapi.com/api/v4/locations/reviews/settings/edit \-H "Authorization: API $LISTINGSAPI_KEY" \-H "Content-Type: application/json" \-d '{ "locationId": "TG9jYXRpb246MTgwMDI4OQ==", "positiveInteractionThreshold": 4, "siteUrls": [ { "name": "maps.google.com", "url": null }, { "name": "yelp.com", "url": "https://www.yelp.com/biz/blue-bottle-coffee-oakland" } ]}'{ "data": { "editInteractionsSetting": { "errors": null, "interactionSetting": { "locationId": "1800289", "positiveInteractionThreshold": 4, "siteSettings": [ { "name": "maps.google.com", "url": null, "monitored": true, "canRespond": true }, { "name": "yelp.com", "url": "https://www.yelp.com/biz/blue-bottle-coffee-oakland", "monitored": true, "canRespond": false } ] } } }}读取 data.editInteractionsSetting.interactionSetting.siteSettings[] 以获取已存储的选择。monitored 表示来源处于启用状态;canRespond 表示是否可以通过 API 在该来源上发布商家回复。未通过验证的来源,例如 URL 无法访问或网站不在套餐范围内,会在 errors 中返回,且设置保持不变,因此收到 200 时,请检查 errors。在这种情况下,SDK 会抛出 ValidationError。
列出某个地点的评价
GET /locations/{locationId}/reviews 是位于 data.interactions 的游标连接,按从新到旧的顺序排列。first 默认为 20,因此单次调用从不会返回完整历史记录。数组筛选条件以 JSON 字符串形式放在查询字符串中,且必须做 URL 编码;cURL 示例通过配合使用 -G 和 --data-urlencode 来完成编码。
此外,还支持参考页面中列出的可选参数 category、categories 和单值参数 ratingFilter。
curl -G "https://listingsapi.com/api/v4/locations/TG9jYXRpb246MTgwMDI4OQ==/reviews" \-H "Authorization: API $LISTINGSAPI_KEY" \--data-urlencode 'ratingFilters=[1,2]' \--data-urlencode 'responseStatus=["PENDING"]' \--data-urlencode 'sortOrder=["NEWEST_FIRST"]' \--data-urlencode 'first=25'{ "data": { "interactions": { "pageInfo": { "hasNextPage": true, "endCursor": "SW50ZXJhY3Rpb246MV8xNTU0..." }, "edges": [ { "node": { "id": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841", "source": "maps.google.com", "content": "nice place for family together", "authorName": "vaibhav nakate", "rating": 5, "date": "2019-04-02T22:11:13.036997+00:00", "type": "Review", "responded": false, "responseCount": 0, "canRespond": true, "permalink": "https://maps.google.com/maps?cid=..." }, "cursor": "SW50ZXJhY3Rpb246MV8xNTU0..." } ], "totalCount": 425 } }}读取 edges[].node。id 是您回复时需要传入的值,canRespond 表示该来源是否接受商家回复。totalCount 是整个结果集中的匹配数,而非当前页的匹配数。当 hasNextPage 为 false,或某一页返回空的 edges 时,停止分页;如果分页边界恰好落在最早的评价上,下一页将为空页。
使用汇总接口遍历所有地点
GET /rollup_interactions 是位于 data.rollupInteractions 的相同游标连接,涵盖该密钥可访问的所有地点,每个节点都包含数值型 locationId。它接受与单个地点的列表接口相同的筛选条件。它不支持地点筛选;locationIds 参数会被忽略,而不会被拒绝。目前两个 SDK 都尚未封装此端点,因此示例使用 requests 和 fetch。
curl -G "https://listingsapi.com/api/v4/rollup_interactions" \-H "Authorization: API $LISTINGSAPI_KEY" \--data-urlencode 'responseStatus=["PENDING"]' \--data-urlencode 'sortOrder=["NEWEST_FIRST"]' \--data-urlencode 'first=50'{ "data": { "rollupInteractions": { "pageInfo": { "hasNextPage": true, "hasPreviousPage": false }, "edges": [ { "node": { "id": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841", "source": "maps.google.com", "content": "Excellent service, highly recommend.", "rating": 5, "responded": false, "canRespond": true, "locationId": 1800289 }, "cursor": "SW50ZXJhY3Rpb246OWUyNmQyYTg=" } ], "totalCount": 1284 } }}按 locationId(即门店的 databaseId)对节点分组。汇总接口的 pageInfo 可能不包含 endCursor,因此请将最后一个 edge 的 cursor 用作 after;这两个值等价。使用 startDate 和 endDate 限定定时运行的范围,避免重新读取历史记录,并在收到 429 时遵循 Retry-After。
按 id 获取评价
GET /reviewDetails 返回已存储评价的最新副本,无需分页。响应是位于 data.interactionDetails.interactions 的普通数组,不包含 edges 或 pageInfo,每条评价都包含其 responses。使用它重新加载关注列表中的评价数据,并查找编辑或归档所需的 responseId。
curl -G "https://listingsapi.com/api/v4/reviewDetails" \-H "Authorization: API $LISTINGSAPI_KEY" \--data-urlencode 'interactionIds=["b2fa765e-c62b-4e0b-b1d6-1c67c855f5e0"]'{ "data": { "interactionDetails": { "interactions": [ { "id": "b2fa765e-c62b-4e0b-b1d6-1c67c855f5e0", "source": "maps.google.com", "content": "Great place for dessert!", "rating": 5, "responded": true, "responseCount": 1, "canRespond": true, "responses": [ { "id": "2090753a-ece6-4837-8336-8494ad308523", "content": "Thank you so much for the kind words!", "interactionStatus": "CONFIRMED", "editedResponse": false } ] } ] } }}responses[].id 是编辑和归档端点所需的 responseId。使用其他账户的 id 时,会返回 200,其中包含 interactionDetails: null 和 SY90001 错误,因此请在按索引访问前检查 null。
评价和回复字段
属性参考 是一个仅用于文档说明的页面,列出了评价对象和回复对象的所有字段。您最常用的字段如下:
responses[] 中的每条回复都包含 id、content、authorName、date、interactionStatus、editedResponse、respondedWith(模板 id)和 remarks(失败详情)。interactionStatus 会依次经历以下状态:
发布商家回复
POST /locations/reviews/respond 在来源平台上发布公开回复。字段直接放在请求体中。回复会立即被接受并异步送达,因此 interactionStatus 的初始值为 CREATED。请先检查评价的 canRespond。
curl -X POST https://listingsapi.com/api/v4/locations/reviews/respond \-H "Authorization: API $LISTINGSAPI_KEY" \-H "Content-Type: application/json" \-d '{ "interactionId": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841", "responseContent": "Thank you for visiting Jenny Home: we are glad you enjoyed your experience!"}'{ "data": { "respondToInteraction": { "interaction": { "id": "2090753a-ece6-4837-8336-8494ad308523", "interactionId": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841", "content": "Thank you for visiting Jenny Home: we are glad you enjoyed your experience!", "interactionStatus": "CREATED", "editedResponse": false }, "errors": null } }}请保留 interaction.id:它是编辑和归档时使用的 responseId。被拒绝的回复会以 200 返回,且 data.respondToInteraction 内的 errors 会被填充,因此请读取响应体;SDK 会抛出 ValidationError。稍等片刻后,通过 id 重新读取评价,查看回复是否已达到 COMPLETED 或 CONFIRMED 状态。
编辑回复
POST /locations/reviews/respond/edit 修改现有回复的文本。修改后的回复会重新提交到平台,因此 interactionStatus 会恢复为 CREATED,送达后 editedResponse 会变为 true。对于只允许 1 条回复的平台,请优先编辑,而不是归档后重新发布。
curl -X POST https://listingsapi.com/api/v4/locations/reviews/respond/edit \-H "Authorization: API $LISTINGSAPI_KEY" \-H "Content-Type: application/json" \-d '{ "reviewId": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841", "responseId": "2090753a-ece6-4837-8336-8494ad308523", "responseContent": "Thank you again: we have updated our reply to include our new store hours."}'{ "data": { "editResponse": { "status": "true", "reviewId": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841", "responseId": "2090753a-ece6-4837-8336-8494ad308523" } }}编辑被接受时,status 为字符串 "true"。请调用详情接口确认新的措辞,并检查回复的 interactionStatus。
归档回复
POST /locations/reviews/respond/archive 会从我们这边跟踪的该评价的 responses 中移除一条回复。这是软删除:已在 Google、Yelp 或 Facebook 上公开发布的回复仍会保留在相应平台上。请用它清理失败或已被替代的草稿;对于已发布的回复,请使用编辑功能。
curl -X POST https://listingsapi.com/api/v4/locations/reviews/respond/archive \-H "Authorization: API $LISTINGSAPI_KEY" \-H "Content-Type: application/json" \-d '{ "responseId": "2090753a-ece6-4837-8336-8494ad308523" }'{ "data": { "archiveResponse": { "status": "true" } }}归档后,评价的 responseCount 会减少,responded 会反映剩余的回复。
列出客户反复提及的短语
GET /review-phrases 在 data.newReviewPhrases 处返回一个普通数组,每个反复出现的短语对应一个条目,每个条目的统计数据仅根据包含该短语的评价计算。结果不分页;请使用 phraseCount 限制返回数量。所有筛选条件均为可选,且可以组合使用,因此将 ratingFilters=[1,2] 与 startDate 结合使用即可获取上一季度的投诉。
此外,还支持参考页面上列出的可选参数 categories,以及已弃用的单值参数 category 和 ratingFilter。
curl -G "https://listingsapi.com/api/v4/review-phrases" \-H "Authorization: API $LISTINGSAPI_KEY" \--data-urlencode 'locationIds=[1800289]' \--data-urlencode 'ratingFilters=[1,2]' \--data-urlencode 'startDate=2026-06-01' \--data-urlencode 'endDate=2026-08-31' \--data-urlencode 'phraseCount=10'{ "data": { "newReviewPhrases": [ { "reviewPhrase": "friendly staff", "phraseStats": { "stats": [ { "name": "total-reviews", "value": 46, "delta": 12.5, "abs": 5 }, { "name": "overall-rating", "value": 4.7, "delta": 1.1, "abs": 0.05 } ] } }, { "reviewPhrase": "long wait", "phraseStats": { "stats": [ { "name": "total-reviews", "value": 11, "delta": 37.5, "abs": 3 }, { "name": "overall-rating", "value": 2.9, "delta": -8.4, "abs": -0.27 } ] } } ] }}total-reviews 是短语出现的次数,overall-rating 是这些评价的平均评分,delta 是相较于上一周期的百分比变化,abs 是绝对变化量。带有 SY90003 的 403 表示密钥无权读取所请求的某个地点。
读取某个地点的评价 KPI
GET /locations/{locationId}/review-analytics-overview 在 data.interactionsAnalyticsStats.stats 处返回 4 项统计数据。日期范围为可选参数;它会缩小计算这些数值及其变化量的时间窗口。每个 delta 都表示相较于前一个相同时长周期的百分比变化。
curl "https://listingsapi.com/api/v4/locations/TG9jYXRpb246MTgwMDI4OQ==/review-analytics-overview?startDate=2026-08-01&endDate=2026-08-31" \-H "Authorization: API $LISTINGSAPI_KEY"{ "data": { "interactionsAnalyticsStats": { "stats": [ { "name": "total-reviews", "value": 128, "delta": 6.67 }, { "name": "new-reviews", "value": 9, "delta": -25 }, { "name": "overall-rating", "value": 4.43, "delta": 2.31 }, { "name": "review-response-rate", "value": 62.5, "delta": 12.5 } ] } }}没有上一周期数据的新账户会报告值为 100 的 delta,因此请勿将第 1 个月的变化量解读为增长。
获取每日评价时间线
GET /locations/{locationId}/review-analytics-timeline 在 data.interactionsChartData.data 中为每天返回一条记录。如果图表的时间范围很重要,请传入 startDate 和 endDate;省略这两个参数会让服务自行选择时间窗口。添加 site 可单独绘制某个来源的数据。
curl "https://listingsapi.com/api/v4/locations/TG9jYXRpb246MTgwMDI4OQ==/review-analytics-timeline?startDate=2026-08-01&endDate=2026-08-31&site=maps.google.com" \-H "Authorization: API $LISTINGSAPI_KEY"{ "data": { "interactionsChartData": { "data": [ { "date": "2026-08-01", "interactionCount": 4, "averageRating": 4.5 }, { "date": "2026-08-02", "interactionCount": 0, "averageRating": null }, { "date": "2026-08-03", "interactionCount": 7, "averageRating": 4.285714285714286 } ] } }}将 interactionCount 绘制为柱状图,将 averageRating 绘制为折线图。该平均值仅针对当天,并非累计平均值,而且在没有评价的日期为 null,因此请留出空缺,而不要绘制为零。
按来源细分评价分析
GET /locations/{locationId}/review-analytics-sites-stats 在 data.interactionsSitesStats.stats 中为每个评价来源返回一条记录。使用它可找出哪个平台使平均值发生了变化。
curl "https://listingsapi.com/api/v4/locations/TG9jYXRpb246MTgwMDI4OQ==/review-analytics-sites-stats?startDate=2026-08-01&endDate=2026-08-31" \-H "Authorization: API $LISTINGSAPI_KEY"{ "data": { "interactionsSitesStats": { "stats": [ { "key": "google", "siteUrl": "maps.google.com", "averageRating": { "value": 4.6, "delta": 2.2 }, "totalInteractions": { "value": 412, "delta": 6.1 }, "newInteractions": { "value": 24, "delta": 33.3 }, "recency": "2026-09-06T14:12:00Z", "baseRating": 4.5, "baseInteractions": 388, "humanizedRecency": "3 days ago" }, { "key": "facebook", "siteUrl": "facebook.com", "averageRating": { "value": 4.1, "delta": -1.4 }, "newInteractions": { "value": 0, "delta": -100 }, "recency": null, "humanizedRecency": null } ] } }}averageRating、totalInteractions 和 newInteractions 各自包含一个 value 和一个 delta;baseRating 和 baseInteractions 是用于计算变化量的基准周期起始时的值。recency 是最新评价的时间戳,如果该来源从未返回过评价,则为 null。newInteractions 为 0 且 recency 已是数月前的时间,通常意味着来源连接已失效,因此请检查该地点的来源。
您会遇到的错误
写入操作也可能返回 200,且 data.<op> 内的 errors 已填充,因此请读取每次写入操作的响应体。完整列表请参阅错误代码。