We provide APIs in JSON format for queries on all the time series tables in the SingStat Table Builder. You can customise the API response to your requirements and test it via the " Test Developer APIs" page.

API to search resourceID

/timeseries/resourceId

Usage and SDK Samples

                                                                   
$(document).ready(function() {
    $.ajax({
        type: "GET",
        dataType: "json",
        url: "http://www.tablebuilder.singstat.gov.sg/publicfacing/rest/timeseries/resourceId?keyword=gas&searchOption=all",
        cache: false,
        success: function(data) {
          console.log(data);
        }
    });
});
                               

import json
import urllib.request
urlData = "http://www.tablebuilder.singstat.gov.sg/publicfacing/rest/timeseries/resourceId?keyword=gas&searchOption=all"
webURL = urllib.request.urlopen(urlData)
data = webURL.read()
print(data)

Parameters

Query parameters
Name Description
Keyword*
String
Search text : All, Title, Variable
Required

Responses

Status: 200 - get metadata

                         

{
  generatedBy  :  string
  generatedDate:  string
  total        :  integer
  records:        {
                      resourceId: integer
                      title     : string
                     
                  }
}                                  
                                  

API to retrieve metadata

/timeseries/metadata

Usage and SDK Samples


var resourceId = 12359;                                                                     
$(document).ready(function() {
    $.ajax({
        type: "GET",
        dataType: "json",
        url: "http://www.tablebuilder.singstat.gov.sg/publicfacing/rest/timeseries/metadata/" + resourceId,
        cache: false,
        success: function(data) {
          console.log(data);
        }
    });
});
                               

import json
import urllib.request
urlData = "http://www.tablebuilder.singstat.gov.sg/publicfacing/rest/timeseries/metadata/12359"
webURL = urllib.request.urlopen(urlData)
data = webURL.read()
print(data)

Parameters

Query parameters
Name Description
resourceId*
String
ID of the time series table (in numeric format) to be searched.
Required

Responses

Status: 200 - get metadata

                         
{
  generatedBy:    string
  generatedDate:  string
  records:        {
                      resourceId:         integer
                      title:              string
                      frequency:          string
                      uom:                string
                      datasource:         string
                      url:                string
                      footnote:           string
                      startPeriod:        string
                      endPeriod:          string
                      downloadFormats:    string
                      termsOfUse:         string
                      apiTermsOfService:  string
                      variables:  
                                          [
                                           {
                                              variableCode: string
                                              variableName: string
                                              level:        string
                                              uom:          string
                                              footnote:     string
                                           }
                                          ]
                  }
}                                   
                                  

API to retrieve data

/timeseries/tabledata/{resourceId}

Usage and SDK Samples



var resourceId      = 12359;  
var variablesValue  = 'M014531.1.1.1,M014531.1.1.2';
var betweenValue    = '5000,8000';     
var sortByValue     = 'value desc';      
var offsetValue     = 0;
var limitValue      = 2000;
var timeFilterValue = '1990 Jan';
var searhValue      = 'Manufacturing';                                                
$(document).ready(function() {
    $.ajax({
        type: "GET",
        dataType: "json",
        url: "http://www.tablebuilder.singstat.gov.sg/publicfacing/rest/timeseries/tabledata/"+resourceId+"?variables="+variablesValue+"&between="+betweenValue+"&sortBy="+sortByValue+"&offset="+offsetValue+"&limit="+limitValue+"&timeFilter="+timeFilterValue+"&search="+searhValue,
        cache: false,
        success: function(data) {
          console.log(data);
        }
    });
});



import json
import urllib.request
urlData = "http://www.tablebuilder.singstat.gov.sg/publicfacing/rest/timeseries/tabledata/12359?variables=M014531.1.1.1,M014531.1.1.2&between=5000,8000&sortBy=value desc&offset=0&limit=2000&timeFilter=1990 Jan&search=Manufacturing"
webURL = urllib.request.urlopen(urlData)
data = webURL.read()
print(data)

Parameters

Path parameters
Name Description
resourceId*
String
ID of the time series table (in numeric format) to be searched.
Required
Query parameters
Name Description
variables
array[String]
Specify list of variable(s) to be returned by indicating the variableCode(s) for the table. There should be no spacing between the variable codes.
Example:
variableCode 1,variableCode 2
between
String
Specify a range within which the data values are to be filtered to give the returned result. The start and end points of the range are to be included. There should be no spacing between the values and commas.
Example:
1560,1677
sortBy
array[String]
Sort the returned records in descending or ascending order by the following fields: time, level, value, variableCode and variableName.
Example:
value desc
variableCode asc
offset
BigDecimal
Specify the first n number of records to be excluded in the returned result.
Example:
offset=50
limit
BigDecimal
Specify the number of records to be included in the returned result.
Example:
limit=50
timeFilter
array[String]
Return records of specific time points based on the type of selected table (monthly, half-yearly, quarterly, annual). There should be no spacing between commas.
Example:
For the quarterly table, timeFilter=2017 4Q,2018 1Q
For the annual table, timeFilter=2017,2018
For the monthly table, timeFilter=2018 Mar
For the half yearly table, timeFilter=2018 H1
search

Responses

Status: 200 - get tabledata.

                         
{
  resourceId:     integer
  url:            string
  total:          integer
  offset:         integer
  limit:          integer
  footnote:       string
  uom:            string
  datasource:     string
  generatedBy:    string
  generatedDate:  string
  variables:      [{
                    variableCode: string
                    variableName: string
                    level:        string
                    uom:          string
                    footnote:     string
                  }]
  records:        [{
                    frequency:    string
                    time:         string
                    level:        string
                    value:        string
                    variableName: string
                    variableCode: string
                  }]
}