Sub Product API
List all sub-products
You can get a list of all your currently published sub products by calling the following endpoint.
URL |
/api/v3/subproduct/all/?page=<page number>&per_page=<page size> |
Method |
GET |
Key |
Type |
Description |
page number |
Integer |
Optional GET parameter to indicate the page of subproducts to be returned. Defaults to 1 if no page number is provided, or is not greater than 0. |
per page |
Integer |
Optional GET parameter to indicate the size of each page in response. Default value is 100 records per page |
Calling the endpoint above provides a way to list all the currently defined subproducts on the platform. When a successful request is made to this endpoint, the server response will contain a single key “sub_products” that will be a list of sub products e.g.
{
"sub_products": [
{
"name": "Sub Product Name",
"slug": "sub-product-name",
"parternship": "Partner A",
"type": "Travel",
"published": true,
"policy_description": "Policy description text",
"claim_description": "Claim description text"
}
]
}
Key |
Type |
Description |
name |
String |
The name of your sub product. |
slug |
String |
A unqiue URL safe string based off of the subproduct’s name. |
partnership |
String |
A string representation of the partnership that is associated with the policy product. If no partnerships is defined this value will be null. |
type |
String |
The sub product type, which is defined by the parent product (see Product Types for details). |
published |
Boolean |
A boolean flag to indicate if the subproduct is currently published. |
policy_description |
String |
Optional text description to be displayed when someone is looking to purchase a policy |
claim_description |
String |
Optional text description to be displayed when listing claim options |
To help with performance, the system will limit the number of subproducts returned from a single request to a maximum of 100 items. If you have more than 100 subproducts defined then further sets can be retrieved using additional requests, setting the “page” GET parameter appropriately. For example, setting “page=2” on your request would return subproducts 101 to 200.
By default if this GET parameter is not defined or deemed invalid (i.e. less than 1), then the server will default to 1. If you request a page outside the number of subproducts defined then an empty list will be returned.
In addition, you can request larger sets of data by using the “per_page” GET parameter. The maximum page size is 1000.
List sub-products for a product
URL |
/api/v3/subproduct/<product slug>/?page=<page number> |
Method |
GET |
Key |
Type |
Description |
product slug |
The specific product slug for the product you wish to filter sub products by. |
|
page number |
Integer |
Optional GET parameter to indicate the page of subproducts to be returned. Defaults to 1 if no page number is provided, or is not greater than 0. |
This endpoint provides a method to get a list of sub-products which are defined for a specific product. The format of JSON response will be the same as for the general list all sub-products endpoint.
{
"sub_products": [
{
"name": "Sub Product Name",
"slug": "sub-product-name",
"type": "Travel",
"published": true,
"policy_description": "Policy description text",
"claim_description": "Claim description text"
},
]
}
Key |
Type |
Description |
name |
String |
The name of your sub product. |
slug |
String |
A unique URL safe string based off of the subproduct’s name. |
type |
String |
The sub product type, which is defined by the parent product (see Product Types for details). |
published |
Boolean |
A boolean flag to indicate if the subproduct is currently published. |
policy_description |
String |
Optional text description to be displayed when someone is looking to purchase a policy |
claim_description |
String |
Optional text description to be displayed when listing claim options |
To help with performance, the system will limit the number of subproducts returned from a single request to a maximum of 100 items. If you have more than 100 subproducts defined for the specified product, further sets can be retrieved using additional requests, setting the “page” GET parameter appropriately. For example, setting “page=2” on your request would return subproducts 101 to 200.
By default if this GET parameter is not defined or deemed invalid (i.e. less than 1), then the server will default to 1. If you request a page outside the number of subproducts defined then an empty list will be returned.
In addition, you can request larger sets of data by using the “per_page” GET parameter. The maximum page size is 1000.
Errors
Code |
Reason |
404 |
Product not found. |
Please refer to the Error Handling section for further details on errors and error handling.
Lookup subproduct by master policy number
URL |
/api/v3/subproduct/lookup/?master-policy-number=<master policy number> |
Method |
GET |
Key |
Type |
Description |
master policy number |
String |
URL encoded GET parameter which matches the master policy code associated with a subproduct |
This endpoint provides a method to get lookup a subproduct based upon the master policy number value. The format of JSON response will be the same as for the general list all sub-products endpoint.
{
"sub_products": [
{
"name": "Sub Product Name",
"slug": "sub-product-name",
"type": "Travel",
"published": true
},
]
}
Key |
Type |
Description |
name |
String |
The name of your sub product. |
slug |
String |
A unique URL safe string based off of the subproduct’s name. |
type |
String |
The sub product type, which is defined by the parent product (see Product Types for details). |
published |
Boolean |
A boolean flag to indicate if the subproduct is currently published. |
List coverage items
URL |
/api/v3/subproduct/<subproduct slug>/coverage-items/?page=<page number> |
Method |
GET |
Key |
Type |
Description |
subproduct slug |
String |
The unique slug for the subproduct that you wish to list coverage items for. |
page number |
Integer |
Optional GET parameter to indicate the page of subproducts to be returned. Defaults to 1 if no page number is provided, or is not greater than 0. |
{
"coverage_items": [
{
"name": "Coverage item",
"slug": "coverage-item",
"amount": "0.00",
"description": "This coverage items....",
"is_optional": true,
"is_preselected": false,
"optional_amount": "1000.00"
}
]
}
Key |
Type |
Description |
name |
String |
The name of your coverage item. |
slug |
String |
A unique URL safe string based off of the coverage item’s name. |
amount |
Decimal |
The amount of coverage offered by this item. |
description |
String |
A textual description of the coverage item. |
is_optional |
Boolean |
A boolean value to indicate if this coverage item is an optional element for the subproduct |
is_preselected |
Boolean |
A boolean value to indicate if the optional coverage item should be preselected for the user to start with |
optional_amount |
Decimal |
The cost of the optional extra, which will be added to the base price of the policy |
Note
The keys “is_preselected” and “optional_amount” will only be included if “is_optional” is ‘true’.
Errors
Code |
Reason |
404 |
Subproduct not found. |
Please refer to the Error Handling section for further details on errors and error handling.