POST
/api/v4/locations/reviews/settings/edit編輯地點的評論設定
設定地點要監控的評論來源,以及正面評論的門檻。
參數
請求主體
標示為必填的巢狀欄位僅在您傳送其上層欄位時適用。如果上層欄位為選填且您省略它,其必填子欄位便不適用。
| 名稱 | 類型 | 必填 | 說明 |
|---|---|---|---|
| locationId | string | 必填 | 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`. |
| siteUrls | array | 選填 | 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[].name | string | 選填 | Site key, as returned in `siteSettings[].name` (e.g. `maps.google.com`, `yelp.com`). |
| siteUrls[].url | string | 選填 | The location's page URL on that site. Send `null` or omit to stop monitoring a source that needs an explicit URL. |
| positiveInteractionThreshold | integer | 選填 | Star rating at or above which a review counts as positive. Sent on its own, it leaves the source selection untouched. |
請求範例
可直接貼上的請求主體。請將預留位置 ID 與值換成您自己的。
{ "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.
{ "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,即可變更來源而不影響門檻。
新增來源會排程擷取該來源的資料,因此新加入網站的評論會以非同步方式取得,而不會包含在這次回應中。未通過驗證的來源(網址無法連線,或帳戶方案未包含的來源)會在 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" } ] }'