Data API
When to use it
You would use the Data API when you have an array of customer domain data and want to do any of the following things:
allow the webapp user to choose a value for some field from a predefined set, not adding another value to the set;
validate the user input against a predefined set of values both on frontend and backend;
populate some more fields based on the user’s choice in another field;
allow to choose values for different fields, thus filtering and narrowing down the choices for the following fields belonging to the same set of data;
limit the availability of the whole set to a certain account;
limit the availability of certain fields to frontend.
How to use it
A typical usage flow:
The frontend app requests a list of items for a dropdown to display on the field with the dataset rule from the Data API, specifying the dataset fields;
The Data API responds with a list of item IDs and values for the chosen dataset fields;
User selects a value;
The frontend app requests a single dataset item by its ID;
The API responds with the full set of public fields for the item;
The frontend app submits a dataset item ID in the payload for the field instead of a set of fields (e.g. company data) to the quote or policy API, e.g.
"some_field”: ”dai_some_dataset_item_id________”
.
How to retrieve the data
Note
All of the retrieval samples below show unauthenticated requests for publicly available datasets.
When you need to access a dataset locked to an account, add an Authentication: Bearer YOUR_TOKEN
header to the request.
Get a dataset information record
Get a dataset information record
GET
https://api.kaskocloud.com/datasets/{datasetId}
Path Parameters
datasetId*
String
Dataset ID
List items from a set
List items from a set.
GET
https://api.kaskocloud.com/datasets/{datasetId}/dataset_items
Path Parameters
datasetId*
String
Dataset ID
Query Parameters
language*
String
Language
fields*
JSON
Fields to output in the value
property
limit*
Integer
Number of items per page, 1 to 100, default = 20
starting_after
String
Item ID to start the page after
ending_before
String
Item ID to end the page before
query
JSON
Search query
sort
JSON
Sorting order
The query
parameter format is [{"field": "FIELD", "search": "VALUE", "operator": "OPTIONAL_OPERATOR"}]
.
The search
field of the query
parameter supports %
wildcards; the accepted operators are >
, >=
, <
, <=
, and IN
. The type of the value is array for the IN
operator and string for everything else.
Sample search
value:
The sort
parameter format is [{"field": "FIELD", "dir": "asc|desc"}]
.
Example Request
The Link
header holds the links for the next and previous page queries.
List distinct values of a field in a dataset
List items from a set.
GET
https://api.kaskocloud.com/datasets/{datasetId}/items_distinct_values
Path Parameters
datasetId*
String
Dataset ID
Query Parameters
language*
String
Language
fields*
JSON
Fields to output in the value
property
limit*
Integer
Number of items per page, 1 to 100, default = 20
starting_after
String
Item ID to start the page after
ending_before
String
Item ID to end the page before
query
JSON
Search query
sort
JSON
Sorting order
Get one item
Get dataset item
GET
https://api.kaskocloud.com/dataset_items/{itemId}
Query Parameters
language*
String
Language
Sending data to backend
Instead of the literal values in the dataset item you send the item ID.
Example Request For a Quote:
The backend service transparently converts this input to the full item available to use in pricing, policy, etc.
Last updated