List Available Insurance Products
Get a List of Available Insurance Products
Now to display every available insurance you want to advertise to your customers, we will begin by requesting to obtain the list of available insurance products from the Curacel Sandbox server. Remember that the Sandbox data is not real-time data, it is just for testing purposes, when it is time to integrate Grow into your app in real-time, you should use the Production/Live URL.
Let's Make a Request!
Open up your terminal window or Git Bash terminal and paste the following request using the 'curl' command.
curl --request GET \
--url 'https://api.playbox.grow.curacel.co/api/v1/products' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>'
Ensure you replace the _<YOUR_API_KEY>_
in the header part with the unique API key, you generated earlier. This request should give you a response that looks like this:
{
"data": [
{
"title": "AXA Classic 1",
"id": 1,
"code": "6857ryh",
"description": "I suppose it were nine o'clock in the pool, and the sounds will take care of the tea--' 'The twinkling of the singers in the distance would take the place of the way--' 'THAT generally takes some time,' interrupted the Hatter: 'it's very rude.' The Hatter was the first figure,' said the Caterpillar called after it; and as Alice could see her after the others. 'Are their heads down! I am in the distance. 'Come on!' and ran till she was looking down with wonder at the door--I do wish I had not.",
"insurer": {
"code": "AXA",
"name": "AXA MANSARD",
"logo_url": "https://www.axamansard.com/images/axa-logo.png",
"terms_conditions": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas faucibus condimentum dui eu porta. Proin dignissim augue vel magna ornare facilisis. Sed euismod malesuada lorem, tempor convallis nunc facilisis sit amet. Nunc mattis sem a est dictum, non auctor ante sodales. Phasellus scelerisque nisl urna, a euismod arcu sodales sed. Sed dictum ante non nunc suscipit, fringilla lobortis erat bibendum. Fusce sed pharetra ligula, malesuada semper arcu. Maecenas eu fringilla felis, vitae sodales dui. Vivamus pretium risus sodales enim molestie, eu cursus turpis vestibulum. Phasellus elementum velit in gravida tincidunt. Cras luctus nulla et mauris varius porta id id elit. Nulla nec egestas eros.\r\n\r\nAliquam egestas ultricies lectus sit amet placerat. Nunc sapien massa, dapibus at sem nec, interdum accumsan tellus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur pellentesque ligula quis tortor consectetur, pellentesque varius arcu bibendum. Nulla odio erat, blandit sed euismod a, ornare non massa. Cras sed leo ac magna interdum dapibus. Vivamus non iaculis urna. Cras fermentum metus nulla, eget finibus ipsum ultricies nec. Proin tempor rhoncus enim at rhoncus.\r\n\r\nSed et ullamcorper nulla. Nunc ultricies arcu nec enim pellentesque, eget tristique augue vestibulum. Praesent ut vulputate erat. Nunc lectus dui, molestie ultricies iaculis eu, tincidunt vel lacus. Suspendisse placerat velit sit amet nulla sollicitudin finibus. In in volutpat magna, ut convallis ligula. Integer dapibus quam eget consequat fringilla. Morbi aliquam dictum eleifend. Vivamus tristique pretium tristique. Nullam viverra neque id rhoncus interdum. Pellentesque sed commodo arcu. Suspendisse potenti. Curabitur in urna nec lacus tempor dapibus nec eget ex. Sed laoreet ut odio non consectetur. Sed tincidunt dictum dolor.\r\n\r\nIn sit amet lacus lacus. Etiam hendrerit neque purus, sed iaculis est pellentesque eu. Fusce blandit lorem eu egestas sodales. Vivamus fermentum non urna a tincidunt. Quisque risus justo, sollicitudin sit amet congue sed, tempor id tellus. Pellentesque elementum leo vel quam egestas, faucibus finibus risus placerat. Sed porta molestie scelerisque. Duis posuere venenatis elementum. Donec volutpat scelerisque dui, eget lacinia dolor cursus vel. Vivamus fringilla nunc vitae nunc molestie, eu venenatis mauris consectetur. Cras consequat urna in est lacinia pulvinar. Quisque a nisl vel nibh interdum lacinia ac ac diam.\r\n\r\nVestibulum in leo pellentesque, molestie velit a, condimentum diam. Maecenas id diam commodo, euismod tortor ut, congue enim. Aenean ullamcorper id tellus a mattis. Donec consectetur pretium nulla, sed sodales orci ornare commodo. Etiam sodales rhoncus libero ullamcorper luctus. Curabitur rhoncus libero dolor, ut ultrices mauris dapibus vel. In gravida bibendum nibh ut viverra. In ornare nunc in tortor lobortis sagittis eget non turpis.",
"currency": "NGN"
},
"product_type": {
"id": 1,
"name": "Health",
"slug": "health",
"premium_type": "fixed",
"icon_url": "https://res.cloudinary.com/ddble5id6/image/upload/v1636627925/grow/health.svg"
},
"cover_benefits": [],
"created_at": "2022-01-07T09:11:43.000000Z",
"price": "20000.00",
"premium_type": "fixed",
"premium_rate_unit": "NGN",
"premium_rate": "20000.00",
"premium": null,
"partner_commission_rate": "2.50",
"min_premium": null,
"premium_rules": null
}
],
"links": {
"first": "https://api.playbox.grow.curacel.co/api/v1/products?page=1",
"last": "https://api.playbox.grow.curacel.co/api/v1/products?page=8",
"prev": null,
"next": "https://api.playbox.grow.curacel.co/api/v1/products?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 8,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=1",
"label": "1",
"active": true
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=2",
"label": "2",
"active": false
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=3",
"label": "3",
"active": false
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=4",
"label": "4",
"active": false
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=5",
"label": "5",
"active": false
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=6",
"label": "6",
"active": false
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=7",
"label": "7",
"active": false
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=8",
"label": "8",
"active": false
},
{
"url": "https://api.playbox.grow.curacel.co/api/v1/products?page=2",
"label": "Next »",
"active": false
}
],
"path": "https://api.playbox.grow.curacel.co/api/v1/products",
"per_page": 15,
"to": 15,
"total": 119
}
]
The above JSON response contains a bunch of information, which includes the:
- name of insurance you are offering to your customers
- insurer name(s) (in this case, AXA Mansard)
- insurer logo
- the product's code (to be used when purchasing an insurance product)
- type of insurance ( Health, in this case), etc.
In addition, some meta information is contained which allows you to paginate your data on the front end, making it easy to scale your application and feed customers with what you want them to see more.
How to determine the premium(price) of the products
The product list endpoint allows you to query our service for available insurance products. You may then display this information to your customers to enable them to choose a product to purchase.
By default, the products returned will have their premium
field set to null, and the premium is the amount your customers will pay to purchase the product. Depending on the type of product, additional information may be required to determine the premium value.
First, you will need to include the following query parameters in your request:
calculate_premium: set this field to 1 to instruct the system to calculate the premium of each product returned.
type: Include the type
field whenever calculate_premium
is required because the information needed to determine the premium of products depends on the product type.
A sample API call with the parameters is shown below:
curl --request GET \
--url 'https://api.playbox.grow.curacel.co/api/v1/products?calculate_premium=1&type=git' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>'
Depending on the product type, this would usually result in a 422 error response with the details of the required fields. Go ahead and provide the missing fields via query parameters and send the request again. This time, the premium
field of the products should no longer be null. This value is the cost of purchasing the insurance product.
Price for single products
When calling the Get a single insurance product endpoint, you may also need to include the premium of the product. The procedure is similar to the one described above. You simply need to remove the type
query parameter since we can determine this from the product. Then send the request with all the other required fields.
For full documentation and description of every endpoint and parameter, feel free to consult the Curacel Grow Reference Docs