Download dataset
Guide to downloading datasets
This API initiates the download of a single dataset, with optional filtering by columns and rows. For datasets that do not have the CSV extension (ie GeoJSON, KML, PDF etc.), you may skip this endpoint and proceed to the Poll Download API below.
ID of the dataset
API key for higher rate limits (optional)
List of selected columns in filtered dataset.
["name","title","address","email_address"]
Filters defines how users want to filter their dataset. Filters is an array of objects which have columnName
,type
and value
attributes. columnName
refers to the column where the filter is to be applied. The values for type
can be EQ
, LIKE
, or ILIKE
. EQ is direct comparison for filter and is case sensitive. LIKE is similar to EQ but includes partial matching. Any words containing the string in the value
attribute will be matched. ILIKE is the case-insensitive version of LIKE.
{"fitlers":[{"columnName":"epi_week","type":"EQ","value":2},{"columnName":"status","type":"ILIKE","value":"covid"},{"columnName":"epi_year","type":"LIKE","value":23}]}
GET /v1/public/api/datasets/{datasetId}/initiate-download HTTP/1.1
Host: api-open.data.gov.sg
Content-Type: application/json
Accept: */*
Content-Length: 236
{
"columnNames": [
"name",
"title",
"address",
"email_address"
],
"filters": {
"fitlers": [
{
"columnName": "epi_week",
"type": "EQ",
"value": 2
},
{
"columnName": "status",
"type": "ILIKE",
"value": "covid"
},
{
"columnName": "epi_year",
"type": "LIKE",
"value": 23
}
]
}
}
{
"code": 1,
"data": {
"message": "text"
},
"errorMsg": "text"
}
After initiating the download of a dataset, this endpoint below returns a link to access the dataset
ID of the dataset
List of selected columns in filtered dataset.
["name","title","address","email_address"]
Filters defines how users want to filter their dataset. Filters is an array of objects which have columnName
,type
and value
attributes. columnName
refers to the column where the filter is to be applied. The values for type
can be EQ
, LIKE
, or ILIKE
. EQ is direct comparison for filter and is case sensitive. LIKE is similar to EQ but includes partial matching. Any words containing the string in the value
attribute will be matched. ILIKE is the case-insensitive version of LIKE.
{"fitlers":[{"columnName":"epi_week","type":"EQ","value":2},{"columnName":"status","type":"ILIKE","value":"covid"},{"columnName":"epi_year","type":"LIKE","value":23}]}
GET /v1/public/api/datasets/{datasetId}/poll-download HTTP/1.1
Host: api-open.data.gov.sg
Content-Type: application/json
Accept: */*
Content-Length: 236
{
"columnNames": [
"name",
"title",
"address",
"email_address"
],
"filters": {
"fitlers": [
{
"columnName": "epi_week",
"type": "EQ",
"value": 2
},
{
"columnName": "status",
"type": "ILIKE",
"value": "covid"
},
{
"columnName": "epi_year",
"type": "LIKE",
"value": 23
}
]
}
}
{
"code": 1,
"data": {
"status": "text",
"url": "text"
},
"errorMsg": "text"
}
Last updated
Was this helpful?