Introduction
Use Cases:
-
Creating new items: These will be persistently stored in Fideltour, thus helping to automate processes for accessing item data.
-
Retrieving item information: It will be necessary to access item data when we want to obtain its identifier, so that we can include it in our requests. This helps maintain data integrity and reduces the likelihood of errors in the requests.
Available methods:
- GET: Query of an item.
- POST: Insertion of a new item.
Examples:
Currently the different items of Fideltour and their methods are as follows:
- agency - see agency methods
- custom_tags - view custom_tag methods
- room_type - see room_type methods
- regime - see regime methods
- province - see province methods
- town - see town methods
- zone - see zone methods
Below are some examples of creating and displaying items in Fideltour.
Request (POST):
The following example shows a request to add a province in Hotel Data Hub.
In this case the requested field is "name", in others it will be "code", we will adapt the request to the method we are using.Protocol: http/1.1
Method: post
Host/endpoint: https://app.hoteldatahub.io/api/v1/provinces/
Headers:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Body: An example is added below.
- { {
- "name":"Balearic Islands",
- }
Answer(Post):
- { {
- "id":12345,
- "name":"Balearic Islands"
- }
Request (GET):
The following example shows a request for the information of the "junior-suite" room type information.
Protocol: http/1.1
Method: get
Host/endpoint: https://app.hoteldatahub.io/api/v1/room-types/?code=junior-suite
Headers:
- Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BODY: In this case, as a GET-type method, we do not include data in the body of the request, as they are included in the url.
Answer (GET):
We can verify that in the "id" field, the request has returned a number.
This number is the one that we must add in future requests, when you want to indicate that the room type is "junior-suite".
- { {
- "count":1 1 1,
- "next":null,
- "previous":null,
- "results":[ [ [
- { {
- "id":2541,
- "code":"junior-suite"
- }
- ]
- }