Skip to main content

/search/poll

Long polling version of the /search endpoint.

Endpoint URL

https://partners.api.vio.com/v1/search/poll

HTTP Method

POST

Headers

NameRequiredDescription
X-Partner-KeyYesPartner's profile key
Content-TypeYesapplication/json
Accept-EncodingNogzip, deflate, br

Query parameters

NameRequiredTypeDescription
sessionIdNostringThe unique identifier of the long-polling session.

Request body

See /search request body.

Dynamic Click Tracking

Click tracking is available using Dynamic Click Tracking

How to poll

Step 1

Send the first request and wait for server's response. The server will start to collect offers from providers. It will return a response once it finds at least one offer for any hotel or when it has queried all providers (in case of unavailability).

curl --request POST 'https://partners.api.vio.com/v1/search/poll' \
--header 'X-Partner-Key: <profile key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"checkIn": "2023-10-19",
"checkOut": "2023-10-20",
"query": {
"hotelNames": {
"names": [
"New York - New York Hotel and Casino",
"Palms Place Hotel and Spa",
"The Palazzo at The Venetian"
],
"city": "Las Vegas",
"country": "United States"
}
},
"rooms": "2",
"language": "en",
"currency": "EUR",
"userCountry": "DE",
"userDevice": "desktop"
}'

Step 2

Check response completed field. If it's true, then the long-polling session is completed, and no need to send more requests. If it's false, then take the session ID from the sessionId response field, put it in the sessionId query parameter and send the new request to the server (see the <session ID> placeholder in the example). Server will return a response once a new or better offer is found for any hotel or when it has queried all providers and hasn't found any new offers. Every response will have full set of offers including offers from previous iterations (if they were not replaced by better offers from the same providers).

curl --request POST 'https://partners.api.vio.com/v1/search/poll?sessionId=<session ID>' \
--header 'X-Partner-Key: <profile key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"checkIn": "2023-10-19",
"checkOut": "2023-10-20",
"query": {
"hotelNames": {
"names": [
"New York - New York Hotel and Casino",
"Palms Place Hotel and Spa",
"The Palazzo at The Venetian"
],
"city": "Las Vegas",
"country": "United States"
}
},
"rooms": "2",
"language": "en",
"currency": "EUR",
"userCountry": "NL",
"userDevice": "mobile"
}'

Repeat step 2 until response field completed is true.

Response

The response payload has all fields of the /search response and these additional fields:

FieldRequiredTypeDescription
sessionIdYesbooleanUnique ID of the polling session. Put it to the sessionId URL query parameter of every subsequent request in the polling session.
completedYesbooleanIf true then the polling session is completed and no more new offers are available. Keep sending requests to the server until this value is true.