Display Insurance Product Types

Display Insurance Types

As you may know, insurance policy consists of different types depending on what they cover. Let's make a request to display all types of insurance that cover the product or service a customer may buy.

The List all Product Types endpoint provides us with every type of insurance policy available to you from the Grow API.

Right on your terminal or Git Bash, type the following curl command and replace <YOUR_API_KEY> with your actual API key.

curl --request GET \
     --url 'https://api.playbox.grow.curacel.co/api/v1/product-types' \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer <YOUR_API_KEY>'
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer <YOUR_API_KEY>");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.playbox.grow.curacel.co/api/v1/product-types", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The response should be a JSON object containing the list of every insurance type available on the server.

{
    "data": [
        {
            "id": 1,
            "name": "Health",
            "slug": "health",
            "premium_type": "fixed",
            "icon_url": "https://res.cloudinary.com/ddble5id6/image/upload/v1636627925/grow/health.svg"
        },
        {
            "id": 2,
            "name": "Auto",
            "slug": "auto",
            "premium_type": "fixed",
            "icon_url": "https://res.cloudinary.com/ddble5id6/image/upload/v1636627925/grow/auto.svg"
        },
        {
            "id": 3,
            "name": "Life",
            "slug": "life",
            "premium_type": "fixed",
            "icon_url": "https://res.cloudinary.com/ddble5id6/image/upload/v1636627925/grow/life.svg"
        },
        {
            "id": 4,
            "name": "Goods in Transit",
            "slug": "git",
            "premium_type": "relative",
            "icon_url": null
        },
        {
            "id": 5,
            "name": "Marine",
            "slug": "marine",
            "premium_type": "relative",
            "icon_url": null
        },
        {
            "id": 6,
            "name": "Credit Life",
            "slug": "credit_life",
            "premium_type": "relative",
            "icon_url": null
        },
        {
            "id": 7,
            "name": "Gadget",
            "slug": "gadget",
            "premium_type": "relative",
            "icon_url": null
        },
        {
            "id": 8,
            "name": "Fire and Burglary",
            "slug": "fire-and-burglary",
            "premium_type": "relative",
            "icon_url": null
        },
        {
            "id": 9,
            "name": "Travel",
            "slug": "travel",
            "premium_type": "relative",
            "icon_url": null
        },
        {
            "id": 10,
            "name": "Keyman Insurance",
            "slug": "Keyman",
            "premium_type": "relative",
            "icon_url": null
        },
        {
            "id": 11,
            "name": "Job Loss Insurance",
            "slug": "jobloss",
            "premium_type": "relative",
            "icon_url": null
        }
    ]
}