API Documentation

Syntax:
https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=<resource_id>&<parameters>….

Request Parameters

 Parameter Name

 Description

 resource_id

 ID of the resource to be searched.
 Format: resource_id=<resource_id>
 Example: resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6

 filters

 Filters columns based on the specified values.
 Format: filters[<field>]=<one or more values separated by comma>
 Example: filters[end_of_month]=2016-04,2016-05,2016-06

 between

 Filters columns based on a range.
 Format: between[<field>]=<lower value (inclusive)>,<higher value (inclusive)>
 Example: between[end_of_month]=2008-01,2010-12

 query

 Returns records that contain the search string (only for fields with the “text” type).
 Format: query=<string to search>
 Example: query=dollars

 offset

 Number of rows to offset in the returned results.
 Format: offset=<number of rows to offset>
 Example: offset=50

 limit

 Maximum number of rows to return (default: 100).
 The API will only return a maximum of 100 rows. If you wish to retrieve more than 100 rows, combine this with "offset" (refer to the examples below).
 Format: limit=<maximum number of rows to return>
 Example: limit=10

 fields

 Comma separated string of fields to return.
 Format: fields=<field1>,<field2>….
 Example: fields=end_of_month,m1,m2,m3

 sort

 The returned results will be sorted by this field.
 Format: sort=<field1> <asc|desc>
 Example: sort=end_of_month desc

Response Values (in JSON)

 Response Field

 Description

 offset

 Number of rows offset for the query.

 limit

 Maximum number of rows that is returned for the query.

 total

 Total number of rows matching the selected criteria.

 records

 List of matching results.

 timestamp

 The time that this row was last updated. This is represented as the number of seconds which have elapsed since January 1,1970.

 fields

 (not used) For field information, please refer to the API description page (e.g. API for Exchange Rates - End of Period, Daily)

 feeds_flatstore entry_id

 (not used) This field should be ignored.

 feeds_entity_id

 (not used) This field should be ignored.

Examples
The following examples are based on the Exchange Rates data published on the MAS website.

Return the 10 most recent records

 https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6&limit=10&sort=end_of_month desc

Return the rows for Jan, Apr and Jul 2015

 https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6&limit=10&filters[end_of_month]=2015-01,2015-04,2015-07

Return the first 100 rows between the years 2005 and 2015 for USD, Euro and Yen vs the Singapore Dollar

 https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6&limit=100&fields=end_of_month,usd_sgd,eur_sgd,jpy_sgd_100&between[end_of_month]=2005-01,2015-12&sort=end_of_month asc

Return the next 100 rows between the years 2005 and 2015 for USD, Euro and Yen vs the Singapore Dollar

 https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6&limit=100&offset=100&fields=end_of_month,usd_sgd,eur_sgd,jpy_sgd_100&between[end_of_month]=2005-01,2015-12&sort=end_of_month asc

 

Last Modified on 22/05/2017