Skip to main content

Apply Insurance Tutorial

How to apply insurance tutorial​

This guide shows three simple calls to endpoints that consist of obtaining insurance availability for a cart or its items, and apply or remove an insurance.

Let's get started with the examples

Step-by-step examples​

This guide shows how to apply an insurance to a shopping cart step by step.

Prerequisites!

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 Available Insurances​

This call returns the list of available insurances for the products in the shopping cart:

  • token Shopping cart identifier.
  • items List of shopping cart items.
curl --location --request GET 'http://gateway-pre.oneboxtickets.net/onebox-rest2/rest/shoppingCart/availableInsurances?token={{cart-token}}&items=1342,2234,3234' \
--header 'Authorization: Bearer {{access_token}}'

Apply Insurance​

Use this endpoint to apply an insurance using the insurance-id obtained in the previous step:

  • token Shopping cart identifier.
  • insurance Insurance identifier.
curl --location --request POST 'http://gateway-pre.oneboxtickets.net/onebox-rest2/rest/shoppingCart/insurance' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer {{access_token}}' \
--data-urlencode 'token={{cart-token}}' \
--data-urlencode 'insurance={{insurance-id}}'

Delete Insurance​

Use this endpoint to delete the previous applied insurance:

  • token Shopping cart identifier.
curl --location --request POST 'http://gateway-pre.oneboxtickets.net/onebox-rest2/rest/shoppingCart/removeInsurance' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer {{access_token}}' \
--data-urlencode 'insurance={{insurance-id}}'