Download dataset

Guide to downloading datasets

To download an entire dataset via API, you will need to first call the initiate download API, followed by the poll download API.

You may add column and rows filters to get a subset of the dataset, although this is optional.

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.

circle-info

Initiate download for a dataset

get
Path parameters
datasetIdstringRequired

ID of the dataset

Example: d_3f960c10fed6145404ca7b821f263b87
Body
columnNamesstring[]Optional

List of selected columns in filtered dataset.

Example: ["uen","uen_status_desc","entity_type_desc","entity_name"]
filtersarrayOptional

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.
  • type can be EQ, LIKE, or ILIKE:
    • EQ: Direct comparison for filter and is case sensitive.
    • LIKE: Similar to EQ but includes partial matching. Any words containing the string in the value attribute will be matched.
    • ILIKE: Case-insensitive version of LIKE.
Example: [{"columnName":"uen_status_desc","type":"EQ","value":"Registered"},{"columnName":"entity_type_desc","type":"LIKE","value":"Local"},{"columnName":"entity_name","type":"ILIKE","value":"data"}]
Responses
get
/v1/public/api/datasets/{datasetId}/initiate-download

After initiating the download of a dataset, this endpoint below returns a link to access the dataset

Poll download for a dataset after download has been initiated

get
Path parameters
datasetIdstringRequired

ID of the dataset

Example: d_3f960c10fed6145404ca7b821f263b87
Body
columnNamesstring[]Optional

List of selected columns in filtered dataset.

Example: ["uen","uen_status_desc","entity_type_desc","entity_name"]
filtersarrayOptional

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.
  • type can be EQ, LIKE, or ILIKE:
    • EQ: Direct comparison for filter and is case sensitive.
    • LIKE: Similar to EQ but includes partial matching. Any words containing the string in the value attribute will be matched.
    • ILIKE: Case-insensitive version of LIKE.
Example: [{"columnName":"uen_status_desc","type":"EQ","value":"Registered"},{"columnName":"entity_type_desc","type":"LIKE","value":"Local"},{"columnName":"entity_name","type":"ILIKE","value":"data"}]
Responses
get
/v1/public/api/datasets/{datasetId}/poll-download
circle-info

As data.gov.sg is a public shared service, we will apply quotas to ensure that they are fairly used by all users. If you exceed the quota of 5 requests per minute, you’ll likely receive a 429 Error. For higher rate limits - create an API key

Last updated

Was this helpful?