Skip to main content

API Response Formats

Our API supports responses in two primary formats: JSON and XML.

Updated this week

What is an API Response?

When you use the API to request information - such as searching for tourism products or getting details about a specific product - the platform sends back data in a structured way. This structured data is called an API response.

An API response format refers to how the data is organised and presented when it is returned to you from the API.

Our API supports responses in two primary formats: JSON and XML. These formats are widely used in APIs and provide structured data that is easy to parse and integrate into your platform.

JSON (JavaScript Object Notation)

What is it? JSON is a lightweight, easy-to-read and use format that uses text to represent data objects.

Why it’s used: JSON is widely supported and easy to process in most programming languages and web applications, particularly those using JavaScript.

For example:

{
"productId": "12345",
"name": "Ocean View Resort",
"category": "Accommodation",
"attributes": ["Beachfront", "WiFi"]
}

XML (eXtensible Markup Language)

What is it? A markup language that uses tags to define data elements.

Why it’s used: XML is also widely supported, especially in legacy systems.

For example:

<product>

<productId>12345</productId>

<name>Ocean View Resort</name>

<category>Accommodation</category>

<attributes>

<attribute>Beachfront</attribute>

<attribute>WiFi</attribute>

</attributes>

</product>

Selecting Your Response Format

You can specify the response format you prefer by setting the appropriate Accept header in your API request.

For JSON: Accept: application/json

For XML: Accept: application/xml


Managing API Responses

When you receive a response from our API, you will need to handle it effectively within your application:

Parsing the Data

  • In JSON, you can parse the response using functions like JSON.parse() in JavaScript or equivalent methods in other programming languages.

  • In XML, you might use an XML parser or library depending on your programming environment.

Error Handling

The API will return specific error codes if something goes wrong with your request. Be sure to handle these errors effectively, providing meaningful messages to users or logging the errors for troubleshooting.


Need Assistance?

We're Here to Support You. Discover how to access Support when and where it's needed.

Did this answer your question?