Documentation

Operations

The client uses HTTP GET requests in order to get the archived files. 

When calling the service, in order to be able to download the files, the client must supply the username and password OR Api-Key in the request header.

Depending on the version client is using, the HTTP request should be done by X-Username and X-Password OR Api-Key (APITUDE). For new xml clients, cache connection will be done by APIKey only.



Fullrates

This resource allows you to get a .zip file with all the information from our Databank. 
You must send the user credentials as parameters inside the HTTP request headers.

  • https://aif2.hotelbeds.com/aif2-pub-ws/files/full

The response message will contain:

  • HTTP Status Code
  • .zip file with information
  • unique version number of the files provided informed as VERSION parameter in the HTTP response header

HTTP Headers

Operation

Parameter

Type

Description

 

HTTP Request

 

X-Username

Mandatory

User credential

X-Password

Mandatory

Password credential

Api-Key Mandatory APIKey credential

HTTP Response

X-Version

Mandatory

Unique version number of the files


It is the client's responsibility to select the location of the download.



Updaterates

This resource allows you to get a .zip file with all the information from our Databank. 
You must send the user credentials as parameters inside the HTTP request headers.

  • https://aif2.hotelbeds.com/aif2-pub-ws/files/update

The response message will contain:

  • HTTP Status Code
  • .zip file with updated information since the last version you have confirmed if exists
  • unique version number of the files provided informed as VERSION parameter in the HTTP response header


HTTP Headers

HTTP Headers

Operation

Parameter

Type

Description

 

HTTP Request

 

X-Username

Mandatory

User credential

X-Password

Mandatory

Password credential

Api-Key Mandatory APIKey credential

HTTP Response

X-Version

Mandatory

Unique version number of the files


It is the client's responsibility to select the location of the download. If there are no changes in our Databank since your last access, then the HTTP Status Code 204 – No Content will be returned without .zip file.



Confirmversion

This resource allows you to confirm the unique version number of the files which has been successfully processed by your system. 
You must send the user credentials as parameters inside the HTTP request headers.

  • https://aif2.hotelbeds.com/aif2-pub-ws/files/confirm

HTTP Headers

HTTP Headers

Operation

Parameter

Type

Description

 

X-Username

Mandatory

User credential

HTTP Request

X-Password

Mandatory

Password credential

Api-Key Mandatory APIKey credential

 

X-Version

Mandatory

Unique version number to confirm success process


It is the client's responsibility to confirm the successfully processed version.



Accessible environments

The CacheAPI – Files Service can be used in two different environments: TEST and
LIVE. 

TEST environment is connected to the same TEST environment used in the XML Interface Specification. This way you will be able to test both systems with the same data base source.

On the other hand, with LIVE environment you will get all the real information from HotelBeds Databank.

Due to IP restriction control, please provide your XML Support Agent the IP/IP's from which you are planning to run the Files Service. HotelBeds will grant you the access to our systems. 

The user and password OR Api-Key HTTP request parameters must be settled with the values provided by your XML Support Agent. 
Here you have summary tables with the resources corresponding to available operations and environment:

Operation

TEST environment

Fullrates

https://aif2.int.hotelbeds.com/aif2-pub-ws/files/full

Updaterates

https://aif2.int.hotelbeds.com/aif2-pub-ws/files/update

Confirmversion

https://aif2.int.hotelbeds.com/aif2-pub-ws/files/confirm


Operation

LIVE environment

Fullrates

https://aif2.hotelbeds.com/aif2-pub-ws/files/full

Updaterates

https://aif2.hotelbeds.com/aif2-pub-ws/files/update

Confirmversion

https://aif2.hotelbeds.com/aif2-pub-ws/files/confirm





HTTP Response codes

The service will return the error codes returned by the HTTP GET and some additional codes.
The status codes returned by the service are presented below:

2XX Success

200 Ok
A 200 error code means that the request was successful. The response will contain an entity corresponding to the requested resource. 

204 No content
A 204 error code means that the update request was successful but there is no updated information in our data base since your last access. The process is correct and you can send again the same request.

4XX Client Error

The request contains bad syntax or cannot be fulfilled. An error message will be transmitted to the client to explain to him the error situation. 

400 Bad Request
The request contains bad syntax or request parameters are not informed. 

404 Not Found
The requested resource cannot be found but Subsequent requests by the client are permissible. 

408 Request Timeout
The server timed out waiting for the request. 

429 Too many requests
The request exceeds the limit of concurrent requests allowed 

450 Authentication needed
You need to introduce username and password as HTTP request headers. 

451 Not authorized
Your credentials (username and password) do not authorize you to use the service.

5XX Server Error

500 Internal server error
A generic error message, given when no more specific message is suitable.



Connection example

Here you have a Java source code snippet example showing how to access the service for the 3 operations.



// EXAMPLE 1. Access to FULL resource

HttpClient client = new HttpClient();
GetMethod method = new GetMethod("https://aif2.hotelbeds.com/aif2-pub-ws/files/full");
method.addRequestHeader("X-Username","myUserCredential");
method.addRequestHeader("X-Password","myPassCredential"); 
// Execute the HTTP GET request
int status = client.executeMethod(method); 
if (status == 200){
// Get the file as InputStream
InputStream in = method.getResponseBodyAsStream();
// Your process...
}



// EXAMPLE 2. Access to CONFIRM resource

HttpClient client = new HttpClient();
GetMethod method = new GetMethod("https://aif2.hotelbeds.com/aif2-pub-ws/files/confirm");
method.addRequestHeader("X-Username","myUserCredential");
method.addRequestHeader("X-Password","myPassCredential");
method.addRequestHeader("X-Version","versionToConfirm"); 
// Execute the HTTP GET request
int status = client.executeMethod(method); 
if (status == 200){
// Get the file as InputStream
InputStream in = method.getResponseBodyAsStream();
// Your process...
}



// EXAMPLE 3. Access to UPDATE resource

HttpClient client = new HttpClient();
GetMethod method = new GetMethod("https://aif2.hotelbeds.com/aif2-pub-ws/files/update");
method.addRequestHeader("X-Username","myUserCredential");
method.addRequestHeader("X-Password","myPassCredential"); 
// Execute the HTTP GET request
int status = client.executeMethod(method); 
if (status == 200){
// Get the file as InputStream
InputStream in = method.getResponseBodyAsStream();
// Your process...
}