/api/v4/locations/{locationId}/reviewsElenca le interazioni per una sede
Restituisce un elenco di recensioni e interazioni social per una singola sede, con paginazione basata su cursore e filtri.
Parametri
Percorso
| Nome | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
| locationId | string | obbligatorio | Location ID, a raw numeric database ID (e.g. `1800289`) or its Base64-encoded Relay ID (e.g. `TG9jYXRpb246MTgwMDI4OQ==`). |
Query
| Nome | Tipo | Obbligatorio | Descrizione | Predefinito |
|---|---|---|---|---|
| siteUrls | string | facoltativo | JSON-encoded array of publisher hostnames to include, e.g. `["maps.google.com","yelp.com"]`. | — |
| startDate | string | facoltativo | Start of the date-range filter (YYYY-MM-DD). | — |
| endDate | string | facoltativo | End of the date-range filter (YYYY-MM-DD). | — |
| searchString | string | facoltativo | Full-text search across interaction content. | — |
| category | string | facoltativo | Single interaction category, e.g. `REVIEW`. | — |
| categories | string | facoltativo | JSON-encoded array of interaction categories. | — |
| ratingFilters | string | facoltativo | JSON-encoded array of star ratings to include, e.g. `[3,4]`. | — |
| ratingFilter | integer | facoltativo | Single star rating to filter by. | — |
| responseStatus | string | facoltativo | JSON-encoded response-status filter. Values: `RESPONDED`, `PENDING`. | — |
| sortOrder | string | facoltativo | JSON-encoded sort order. Values: `NEWEST_FIRST`, `OLDEST_FIRST`, `LAST_RESPONDED`. | — |
| first | integer | facoltativo | Number of records to return from the beginning (newest first). Defaults to 20 when omitted, the endpoint always returns a single page, never the whole history. | — |
| after | string | facoltativo | Cursor to page forward from. Pass `pageInfo.endCursor`, or equivalently the `cursor` of the last edge in the previous page. | — |
| last | integer | facoltativo | Number of records to return from the end. | — |
| before | string | facoltativo | Cursor to page backward from, used with `last`. Pass the `cursor` of the first edge of the page you are moving back from. `pageInfo` carries no `startCursor` field, so the edge cursor is the value to use. | — |
Risposte
200Paginated interactions result. `data.interactions` holds the connection.
{ "data": { "interactions": { "pageInfo": { "hasNextPage": true, "hasPreviousPage": false, "endCursor": "SW50ZXJhY3Rpb246MV8xNTU0MjQzMDczMDM2LTllMjZkMmE4LWE2ZWQtNDJlYS04NDU0LTQ3ZDFjOTJlYTg0MQ==" }, "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", "category": "Review", "type": "Review", "responded": false, "responseCount": 0, "canRespond": true, "permalink": "https://maps.google.com/maps?cid=..." }, "cursor": "SW50ZXJhY3Rpb246MV8xNTU0MjQzMDczMDM2LTllMjZkMmE4LWE2ZWQtNDJlYS04NDU0LTQ3ZDFjOTJlYTg0MQ==" } ], "totalCount": 425 } }}401Unauthenticated, missing or invalid API key.
429Rate limit exceeded. Retry after the `Retry-After` header value.
Restituisce recensioni e interazioni social per una sede usando la paginazione basata su cursore. Per impostazione predefinita, i risultati sono ordinati dal più recente. La connessione si trova in data.interactions e contiene edges[].node (vedi il riferimento degli attributi delle interazioni), un endCursor in pageInfo e un totalCount.
totalCount è il numero di interazioni che corrispondono ai tuoi filtri nell'intero insieme dei risultati, non il numero restituito in questa pagina. Usalo per stimare le dimensioni di un recupero dei dati storici o per verificare il tuo conteggio: una sede con totalCount: 450, letta con first=50, richiede 9 richieste e la somma dei conteggi dovrebbe essere 450 quando arrivi alla fine. Se ometti first, vengono restituiti 20 record, quindi una singola chiamata non restituisce mai l'intera cronologia.
Caso d'uso: una casella di posta delle recensioni per ciascun negozio
Per creare una casella di posta delle recensioni per una sede, scorri le pagine in avanti con first e after: richiedi first=25, poi passa il valore pageInfo.endCursor della risposta come after nella chiamata successiva. Ogni edge contiene anche il proprio cursor e il valore cursor dell'ultimo edge è il valore endCursor di quella pagina, quindi entrambi i valori possono essere usati come after. Fermati quando hasNextPage è false oppure quando una pagina restituisce un array edges vuoto; verifica entrambe le condizioni, perché una pagina che termina esattamente con la recensione più vecchia è seguita da un'ultima pagina vuota. Aggiungi responseStatus=["PENDING"] per mostrare solo le recensioni ancora in attesa di una risposta del proprietario, oppure ratingFilters=[1,2] per dare priorità alle recensioni negative. Da ciascun node, il valore id è quello da passare a Rispondi a un'interazione, mentre canRespond indica se quella fonte accetta risposte del proprietario.
Caso d'uso: sincronizzazione incrementale
Per mantenere sincronizzata una copia locale, filtra per startDate/endDate e ordina con sortOrder=["NEWEST_FIRST"], salvando in modo persistente il valore date più alto che hai rilevato. Tieni presente che questo endpoint usa la paginazione ed è soggetto a limiti di frequenza: rispetta l'header Retry-After quando ricevi un 429 ed evita di recuperare di nuovo l'intera cronologia a ogni esecuzione.
Google Maps e Facebook sono disponibili in tutti i piani. Yelp è disponibile nei piani Growth ed Enterprise. I filtri codificati in JSON (siteUrls, categories, ratingFilters, responseStatus, sortOrder) vengono passati come stringhe JSON con codifica URL.
curl -X GET 'https://listingsapi.com/api/v4/locations/<locationId>/reviews' \ -H "Authorization: API $LISTINGSAPI_KEY"