Apply Rate Tutorial
How to add a rate tutorial
This guide shows how to apply rates to the shopping cart items.
Let's get started with the examplesStep-by-step examples
This guide shows how to obtaining and apply an rate step by step.
You will need a valid OAuth access_token to be able to make each call! Please refer to our Authentication Guide to obtain one.
Get The Available Rates For A Session
With this simple call we can easily obtain the rates available for a session.
- session-id: The unique identifier of the session that we want to obtain the detailed information, this identifier can be obtained using the events-search or event-info services.
curl --location --request GET 'https://api.oneboxtds.net/onebox-rest2/rest/session/{{session-id}}/info' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{access_token}}'
Note: In the response if the session have rates configured, there is an object called "sessionRates" that contains the names of the rates and their unique IDs.
EXAMPLE RESPONSE:
{
"sessionRates": {
"sessionRate": [
{
"id": "20124",
"name": "PALCO 2 PERSONAS",
"default": "true"
},
{
"id": "20125",
"name": "PALCO 4 PERSONAS",
"default": "false"
}
]
},
}
Add some seats and apply the rates
With this call will add some seats to the shopping cart automatically and in addition will apply a rate from those obtained in the previous call through the parameter idRate:
- session-id The id of the session this seat belongs to.
- amount-of-seats: the amount of seat you wish to add to the shopping cart
- idRate: Use this parameter if you want to apply a rate to the seats (optional).
curl --location --request POST 'http://gateway-pre.oneboxtickets.net/onebox-rest2/rest/shoppingCart/addBestSeats' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer {{access_token}}' \
--data-urlencode 'idSession={{session-id}}' \
--data-urlencode 'numSeats={{amount-of-seats}}' \
--data-urlencode 'idRate={{id-rate}}' \
--data-urlencode 'token={{cart-token}}'
Note: if this param is not informed the default rate will be applied
Modify Rate
Use this service to modify a rate of one or more seats already added to the shopping cart:
- items Receive the desired to modify items list.
- cart-token Shopping cart identifier token.
- id-rate The rate to replace the current one.
curl --location --request POST 'http://gateway-pre.oneboxtickets.net/onebox-rest2/rest/shoppingCart/rate' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer {{access_token}}' \
--data-urlencode 'items=10, 12, 15' \
--data-urlencode 'token={{cart-token}}' \
--data-urlencode 'idRate={{id-rate}}'