Loyalty
Table of contents¶
- Introduction
- Use cases
- Available methods
- Sign In
- Update data
- Login
- Cancel loyalty membership
- Reset password
- Change password
- Get operations
- Get operation
- Add points
- Redeem points
- Get products
- Get product
- Get product translations
- Get product translation
- Get benefits
- Get benefit
- Get benefit translations
- Get benefit translation
Introduction¶
This article covers the API requests related to Fideltour's Loyalty module.
The Swagger sections that include this information are:
- https://app.hoteldatahub.io/swagger/#/contacts
- https://app.hoteldatahub.io/swagger/#/operations
Use cases¶
This part of the API is very useful for adding and managing contacts in Fideltour's loyalty program, coming from different data sources.
- Enroll a Fideltour contact into the customer's loyalty program
- Update the contact's loyalty-related data:
- Update the contact's level
- Update the contact's points
- Update the contact's level points
- List and filter operations related to the loyalty program
- Create an operation to award loyalty points to a contact enrolled in the program
- Create an operation to redeem loyalty points for a contact enrolled in the program
- Log in to the loyalty program
- Request a password change for the loyalty program account
Available methods¶
All the methods and filters available for working with loyalty can be found in the Swagger links mentioned above.
This article focuses on the following:
Sign In¶
Enroll a contact in the loyalty program.
Swagger: https://app.hoteldatahub.io/swagger/#/contacts/contacts_loyalty_sign_in
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| password | String | Yes | Contact's password for their Guest Portal |
| send_activation_email | Boolean | Yes | Sends an activation email to the contact |
| send_welcome_email | Boolean | Yes | Sends a welcome email to the contact |
Request¶
METHOD: POST
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/contacts/{contact_id}/loyalty-sign-in/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BODY:
{
"password": "UTendyE!?",
"send_activation_email": false,
"send_welcome_email": false
}
Response¶
For a 200 response, the JSON you receive has all of the contact's information.
If the contact is already enrolled in the loyalty program, the API responds with a 406 and the following JSON:
{
"error": "Este usuario ya está dado de alta en el club"
}
Update data¶
Update a contact's loyalty data.
Swagger: https://app.hoteldatahub.io/swagger/#/contacts/contacts_loyalty_update_data
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| level | Int | No | Level ID in Fideltour |
| points | Int | No | Contact's points |
| level_points | Int | No | Contact's level points |
| loyalty_bookings | Int | No | Contact's total bookings |
| loyalty_nights | Int | No | Contact's total nights |
| loyalty_last_booking_date | date (yyyy-mm-dd) | No | Date of the contact's last booking |
| loyalty_custom_tag_timestamp | datetime (yyyy-mm-ddThh:mm:ss) | No | Date and time the contact was enrolled in loyalty |
| loyalty_id | String | No | Loyalty card number |
Request¶
METHOD: POST
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/contacts/{contact_id}/loyalty-update-data/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BODY:
{
"level": 2673,
"points": 200,
"level_points": 100
}
Response¶
For a 200 response, the JSON you receive has all of the contact's information.
Login¶
Log in to the loyalty program.
Swagger: https://app.hoteldatahub.io/swagger/#/contacts/contacts_loyalty_login
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| String | Yes | Contact's email | |
| password | String | Yes | Contact's password |
Request¶
METHOD: POST
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/contacts/loyalty-login/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BODY:
{
"email": "test@test.com",
"password": "UTendyE!?"
}
Response¶
For a 200 response, the JSON you receive has all of the contact's information.
Cancel loyalty membership¶
Endpoint to remove a contact from the loyalty program.
Swagger: https://app.hoteldatahub.io/swagger/#/contacts/contacts_loyalty_reset_account
Request¶
METHOD: POST
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/contacts/{contact_id}/loyalty-reset-account/
Note: where
contact_idis the contact's ID in Fideltour.
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, a JSON is returned with the contact's data, with the loyalty-related fields reset.
Reset password¶
Reset the password used to access the loyalty program.
Swagger: https://app.hoteldatahub.io/swagger/#/contacts/contacts_loyalty_reset_password
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| String | Yes | Contact's email |
Request¶
METHOD: POST
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/contacts/loyalty-reset-password/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BODY:
{
"email": "test@test.com"
}
Response¶
For a 200 response, if a contact exists with the given email, an email is sent with the new password set by Fideltour.
Change password¶
Change the password used to access a contact's loyalty program account.
Swagger: https://app.hoteldatahub.io/swagger/#/contacts/contacts_loyalty_change_password
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| new_password | String | Yes | Contact's new password |
Request¶
METHOD: POST
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/contacts/{contact_id}/loyalty-change-password/
Note: where
contact_idis the contact's ID in Fideltour.
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BODY:
{
"new_password": "NewPassword123!"
}
Response¶
For a 200 response, the password has been updated successfully.
Get operations¶
List and filter the customer's loyalty program operations.
Swagger: https://app.hoteldatahub.io/swagger/#/operations/operations_list
Parameter table¶
No required parameters; see all available filters in Swagger.
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/operations/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"count": 5,
"next": null,
"previous": null,
"results": [
{
"id": 405283,
"contact_email": "pserra@customia.com",
"book_room_number": null,
"points": 100,
"expired_points": null,
"consumed_points": -100,
"remaining_points": 0,
"level_points": 0,
"bonus_points": "0.00",
"timestamp": "2023-11-13T12:11:03.746192",
"comments": null,
"concept": "test",
"code": "2991559E1A",
"redeemed": 0,
"point_type": 0,
"expired_date": "2023-11-13T12:11:03.745212",
"updated_at": "2023-11-13T12:11:03.784747",
"contact": 11656629,
"product": null,
"book": null,
"manager": 3738,
"hotel": null
}
]
}
Get operation¶
Get an operation by ID from the customer's loyalty program.
Swagger: https://app.hoteldatahub.io/swagger/#/operations/operations_read
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| id | Int | No | Operation ID sent in the URL |
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/operations/<operation_id>/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"id": 405278,
"contact_email": "pserra@customia.com",
"book_room_number": null,
"points": 100,
"expired_points": null,
"consumed_points": -100,
"remaining_points": 0,
"level_points": 0,
"bonus_points": "0.00",
"timestamp": "2023-11-13T12:05:43.309364",
"comments": null,
"concept": "test",
"code": "B0937118E5",
"redeemed": 0,
"point_type": 0,
"expired_date": "2023-11-13T12:05:43.308445",
"updated_at": "2023-11-13T12:05:43.342388",
"contact": 11656629,
"product": null,
"book": null,
"manager": 3738,
"hotel": null
}
Add points¶
Create an operation to add points to a loyalty program contact.
Swagger: https://app.hoteldatahub.io/swagger/#/operations/operations_add_points
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| contact | Int | Yes | Contact ID |
| concept | String | Yes | Operation concept |
| points | Int | Yes | Points to add to the contact |
| point_type | Int | Yes | Point type: 0 redeemable points, 1 level points. If the chain has the redeemable-points equivalence enabled, a load with 0 also creates the equivalent level points operation |
Request¶
METHOD: POST
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/operations/add-points/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BODY:
{
"contact": 11656629,
"concept": "2023 bookings",
"points": 500,
"point_type": 0
}
Response¶
For a 200 response, you receive the following JSON:
{
"contact": 11656629,
"concept": "2023 bookings",
"points": 500,
"point_type": 0
}
Redeem points¶
Create an operation to redeem points for a loyalty program contact.
Swagger: https://app.hoteldatahub.io/swagger/#/operations/operations_redeem_points
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| contact | Int | Yes | Contact ID |
| concept | String | Yes | Operation concept |
| points | Int | Yes | Points to subtract from the contact |
Request¶
METHOD: POST
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/operations/redeem-points/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BODY:
{
"contact": 11656629,
"concept": "redeemed product",
"points": 100
}
Response¶
For a 200 response, you receive the following JSON:
{
"contact": 11656629,
"concept": "redeemed product",
"points": 100
}
Get products¶
List and filter the customer's loyalty program products.
Swagger: https://app.hoteldatahub.io/swagger/#/products/products_list
Parameter table¶
No required parameters; see all available filters in Swagger.
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/products/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"count": 6,
"next": null,
"previous": null,
"results": [
{
"id": 12345,
"title": "We can't wait to have you back with us.",
"category": 2,
"image": "https://example/fideltour/media/product-image/example_image.jpg",
"points": 12345,
"featured": false,
"start_date": "2022-12-01",
"end_date": "2024-12-31",
"code": "Repetidor1",
"is_visible": true,
"promocode": null,
"notify_alert_emails": true,
"hotels": [101, 102, 103],
"levels": [201, 202]
}
]
}
Get product¶
Get a product by ID from the customer's loyalty program.
Swagger: https://app.hoteldatahub.io/swagger/#/products/products_read
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| id | Int | No | Product ID sent in the URL |
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/products/<product_id>/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"id": 12345,
"title": "We can't wait to have you back with us.",
"category": 2,
"image": "https://example/fideltour/media/product-image/example_image.jpg",
"points": 12345,
"featured": false,
"start_date": "2022-12-01",
"end_date": "2024-12-31",
"code": "Repetidor1",
"is_visible": true,
"promocode": null,
"notify_alert_emails": true,
"hotels": [
12345,
12345,
12345
],
"levels": [
12345,
12345,
12345
]
}
Get product translations¶
List the translations of the customer's loyalty program products. Each translation has its language (language) and the product it belongs to (product).
Swagger: https://app.hoteldatahub.io/swagger/#/product-translations/product-translations_list
Parameter table¶
No required parameters; see all available filters in Swagger.
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/product-translations/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 12345,
"language": "en",
"title": "We look forward to having you back.",
"description": "Description of the product in English.",
"conditions": "Subject to availability.",
"image": "https://example/fideltour/media/product-image/example_image.jpg",
"product": 12345
}
]
}
Get product translation¶
Get a product translation by ID.
Swagger: https://app.hoteldatahub.io/swagger/#/product-translations/product-translations_read
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| id | Int | No | Translation id sent in the URL |
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/product-translations/<translation_id>/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"id": 12345,
"language": "en",
"title": "We look forward to having you back.",
"description": "Description of the product in English.",
"conditions": "Subject to availability.",
"image": "https://example/fideltour/media/product-image/example_image.jpg",
"product": 12345
}
Get benefits¶
List and filter the customer's loyalty program benefits: by type (benefit_type), name, hotels, levels or subscription and unsubscription dates.
Swagger: https://app.hoteldatahub.io/swagger/#/benefits/benefits_list
Parameter table¶
No required parameters; see all available filters in Swagger.
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/benefits/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 12345,
"name": "Late checkout",
"subscribed_date": "2025-01-01T00:00:00Z",
"unsubscribed_date": null,
"benefit_type": 0,
"is_visible": true,
"levels": [201, 202],
"hotels": [101, 102]
}
]
}
Get benefit¶
Get a benefit by ID from the customer's loyalty program.
Swagger: https://app.hoteldatahub.io/swagger/#/benefits/benefits_read
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| id | Int | No | Benefit id sent in the URL |
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/benefits/<benefit_id>/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"id": 12345,
"name": "Late checkout",
"subscribed_date": "2025-01-01T00:00:00Z",
"unsubscribed_date": null,
"benefit_type": 0,
"is_visible": true,
"levels": [201, 202],
"hotels": [101, 102]
}
Get benefit translations¶
List the translations of the customer's loyalty program benefits. Each translation has its language (language) and the benefit it belongs to (benefit).
Swagger: https://app.hoteldatahub.io/swagger/#/benefit-translations/benefit-translations_list
Parameter table¶
No required parameters; see all available filters in Swagger.
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/benefit-translations/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 12345,
"language": "es",
"name": "Salida tardía",
"description": "Salida de la habitación hasta las 14:00.",
"benefit": 12345
}
]
}
Get benefit translation¶
Get a benefit translation by ID.
Swagger: https://app.hoteldatahub.io/swagger/#/benefit-translations/benefit-translations_read
Parameter table¶
| Field | Type | Req. | Description |
|---|---|---|---|
| id | Int | No | Translation id sent in the URL |
Request¶
METHOD: GET
HOST/ENDPOINT: https://app.hoteldatahub.io/api/v1/benefit-translations/<translation_id>/
HEADERS:
Content-type: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Response¶
For a 200 response, you receive the following JSON:
{
"id": 12345,
"language": "es",
"name": "Salida tardía",
"description": "Salida de la habitación hasta las 14:00.",
"benefit": 12345
}