dataset_data Endpoint
The call to the dataset_data
API endpoint returns the Dataset data by ID.
API Call
This is an example of an API call that returns all Dataset data without filtering. The value of the dataset
parameter corresponds to the ID of the Dataset which data is retrieved:
$.ajax({
"url": "/api/dataset_data?dataset=568",
"headers": {"Accept":"application/json"}
}).done(response=>console.log(response))
The second example API call demonstrates how to apply filtering and sorting by using additional query parameters:
$.ajax({
"url": "/api/dataset_data?dataset=568&limit=4&offset=1&amount=Y",
"type": "POST",
data:
{
"sort":
[
{"field":"items_purchased","dir":"DESC"},
{"field": "country","dir":"ASC"}
]
},
"headers": {"Accept":"application/json"}
}).done(response=>console.log(response))
The following query parameters can be utilized to filter out the returned data:
limit
- the number of returned rows,
offset
- the number of rows to be skipped before returning any rows,
amount
- whether to display the total amount of rows in the Dataset.
To sort out the returned data, add an object to the sort
array specifying a field name and sort direction.
It is also possible to retrieve a Dataset View data by using the view
parameter and assigning it the value of a Dataset View ID:
$.ajax({
"url": "/api/dataset_data?dataset=568&view=343",
"headers": {"Accept":"application/json"}
}).done(response=>console.log(response))
This example demonstrates an object which represents a single element.
{
"data":
[
{"Name":"User8","Country":"Algeria","Customer ID":"3","Items Purchased":"4","Date":null},
{"Name":"User7","Country":"Algeria","Customer ID":"3","Items Purchased":"10","Date":null},
{"Name":"User10","Country":"Italy","Customer ID":"2","Items Purchased":"12","Date":null},
{"Name":"User6","Country":"Algeria","Customer ID":"4","Items Purchased":"13","Date":null}
]
"metadata":
[
{"name":"Name","type":"text"},
{"name":"Country","type":"text"},
{"name":"Customer ID","type":"numeric"},
{"name":"Items Purchased","type":"numeric"},
{"name":"Date","type":"datetime"}
],
"amount":6
}