Search and filter within dataset
Datastore search
This API allows you to search for data within a dataset or scan through the rows of the dataset in a paginated manner.
Search Rows in Dataset
Query parameters
resource_idstringRequired
ID or alias of the resource to be searched against. This corresponds to the dataset_id (resource_id is a legacy reference)
limitintegerOptionalDefault:
Maximum number of rows to return (optional, default: 100)
100offsetintegerOptional
Offset this number of rows (optional)
fieldsstringOptional
Fields to return (optional, default: all fields in original order)
filtersstringOptional
Dictionary of matching conditions, e.g {"key1": "a", "key2": "b"}
qstringOptional
Example: {"columnName": "columnValue"}
sortstringOptional
Comma-separated field names with ordering, eg.: "fieldname1, fieldname2 desc"
Responses
200
Fetched data
application/json
successbooleanRequired
Whether fetch is succesfully
429
Rate limit exceeded
application/json
default
Error information
application/json
get/api/action/datastore_search
GET /api/action/datastore_search?resource_id=text HTTP/1.1
Host: data.gov.sg
Accept: */*
{
"success": true,
"result": {
"resource_id": "f9dbfc75-a2dc-42af-9f50-425e4107ae84",
"fields": [
{
"type": "numeric",
"id": "year"
},
{
"type": "text",
"id": "level_1"
},
{
"type": "numeric",
"id": "value"
}
],
"records": [
{
"year": 1960,
"level_1": "Total Residents",
"value": 1646400
},
{
"year": 1960,
"level_1": "Total Male Residents",
"value": 859600
},
{
"year": 1960,
"level_1": "Total Female Residents",
"value": 786800
},
{
"year": 1961,
"level_1": "Total Residents",
"value": 1646400
},
{
"year": 1961,
"level_1": "Total Male Residents",
"value": 859600
}
],
"limit": 5,
"total": 870,
"_links": {
"start": "/api/action/datastore_search?limit=5&resource_id=f9dbfc75-a2dc-42af-9f50-425e4107ae84",
"next": "/api/action/datastore_search?offset=5&limit=5&resource_id=f9dbfc75-a2dc-42af-9f50-425e4107ae84"
}
}
}Last updated
Was this helpful?