POST/api/v4/locations/reviews/settings/edit

编辑地点的评价设置

设置地点监测哪些评价来源,以及该地点的正面评价阈值。

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

参数

请求体

标记为必填的嵌套字段仅在您发送其父字段时适用。如果父字段为可选且您省略了它,其必填子字段不适用。

名称类型必填描述
locationIdstring必填Location to update, as its Base64-encoded Relay ID (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). This is a body field, so unlike path parameters a raw numeric ID is not converted and fails with `SY90002: Invalid Id`.
siteUrlsarray可选The complete set of review sources for the location. This REPLACES the current selection, so send every source you want kept, not just the additions.
siteUrls[].namestring可选Site key, as returned in `siteSettings[].name` (e.g. `maps.google.com`, `yelp.com`).
siteUrls[].urlstring可选The location's page URL on that site. Send `null` or omit to stop monitoring a source that needs an explicit URL.
positiveInteractionThresholdinteger可选Star rating at or above which a review counts as positive. Sent on its own, it leaves the source selection untouched.

请求示例

可直接粘贴的请求体。请将占位 ID 和值替换为您自己的。

Request body
{  "locationId": "TG9jYXRpb246MTgwMDI4OQ==",  "positiveInteractionThreshold": 4,  "siteUrls": [    { "name": "maps.google.com", "url": null },    { "name": "yelp.com", "url": "https://www.yelp.com/biz/blue-bottle-coffee-oakland" }  ]}

响应

200Settings applied. `data.editInteractionsSetting.interactionSetting` returns the stored settings; `errors` is `null` on success.
Response
{  "data": {    "editInteractionsSetting": {      "errors": null,      "interactionSetting": {        "id": "1800289",        "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 }        ]      }    }  }}
401Unauthenticated, missing or invalid API key.
403The key is valid but not permitted to change review settings for this location (`SY90003`).

更新地点所监测的评价来源,以及判定为正面评价的评分。要读取这些设置,请参阅列出地点的评价来源。

siteUrls 是整体替换,而不是局部更新。您发送的数组将成为该地点所选的来源。要添加一个来源,请先读取当前的 siteSettings,然后将现有条目与新条目一起提交;提交仅含一个元素的数组会移除所有其他来源,且不会发出提示。

这两个字段相互独立。仅发送 positiveInteractionThreshold 可更改阈值而不影响来源,仅发送 siteUrls 可更改来源而不影响阈值。

添加来源会为其安排抓取任务,因此新添加网站的评价会异步到达,而不会包含在此次响应中。未通过验证的来源(URL 无法访问,或该来源不在账户套餐涵盖的范围内)会在 errors 中返回,且设置保持不变,因此即使返回 200,也请检查 errors。

使用场景:接入地点的 Yelp 页面

地点创建后,系统会立即自动监测其 Google 和 Facebook 来源,但 Yelp 页面必须明确指定。从设置路由读取当前所选的来源,追加 { "name": "yelp.com", "url": "<the location's Yelp URL>" },然后携带该地点的 ID 提交整个数组。抓取任务会立即进入队列,完成后,首批 Yelp 评价将显示在列出互动中。

此端点会更改实际生效的监测设置。上方的请求和响应仅为示例。

Request
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"      }    ]  }'