Typical journey for using the API to return information on properties within your group:
1. Review the Documentation
You find an endpoint /properties
that retrieves a list of all properties in your group.
2. Authentication
The API requires an API key and a unique trace token:
bashCopy codecurl -X GET "https://api.example.com/properties" -H "x-sm-api-key: YOUR_API_KEY" -H "x-sm-api-key: UUID_V4" -H "accept: application/json"
3. Identify the Endpoint
Endpoint: /properties
Method: GET
Parameters: page
, perPage
4. Construct the Request
bashCopy codecurl -X GET "https://api.example.com/properties?page=1&perPage=10" -H "x-sm-api-key: YOUR_API_KEY" -H "x-sm-api-key: UUID_V4" -H "accept: application/json"
5. Make the API Call
bashCopy codecurl -X GET "https://api.example.com/properties?page=1&perPage=10" -H "x-sm-api-key: YOUR_API_KEY" -H "x-sm-api-key: UUID_V4" -H "accept: application/json"
6. Handle the Response
jsonCopy code{
"page": 1,
"perPage": 10,
"total": 50,
"totalPages": 5,
"items": [
{
"uuid": "f63ce398-da03-4573-856d-ed8d71e57e3d",
"name": "Demo Hotel"
},
...
]
}
7. Handle Errors
If the API key is invalid, you might receive a 401 Unauthorized
response:
jsonCopy code{
"error": "Unauthorized",
"message": "Invalid API key"
}
8. Implement Pagination
To fetch the next page of results, update the page
parameter:
bashCopy codecurl -X GET "https://api.example.com/properties?page=2&perPage=10" -H "Authorization: Bearer YOUR_API_KEY" -H "accept: application/json"
Please review the following document on embedding the Booking Engine into your website.