NFIB’s SBET platform offers a REST API to allow users to perform queries of available SBET data using selection parameters. Developers can make custom calls to the API and receive the results in JSON format.
Developers can access the following datasets from 1974 to the current month and year:
- Small Business Optimism Index values
- Index Components values
- Survey Questions and Response Distributions (Coming Soon)
Basic API Call Structure
All results from SBET are returned using stored procedures with parameters in the backend database. Therefore, to call a stored procedure that requires parameters the following URI format should be used:
POST http://open.api.nfib-sbet.org/rest/sbetdb/_proc/<procedure_name>
Please note that a POST should always be used to call an SBET stored procedure and the required parameters should be added in the HTTP Header.
The outgoing request should consist of the following HEADER parameters:
- app_name – This is the API Key that should always be passed in the call. Required value is “sbet”
- params – An array of parameters definitions and settings for each parameter required by the stored procedure. Each parameter consists of the following elements:
- name – String. Name of the parameter as defined in the stored procedure
- param_type – String. Allowed value of “IN” (input only)
- value – String or Integer. The value to pass into the stored procedure for the parameter
Example
The following call returns monthly values of the Small Business Optimism Index from June 2010 to December 2010.
Sample API Request
Method: POST
Response Content Type: application/json
Parameter Content Type: application/json
URL:
http://open.api.nfib-sbet.org/rest/sbetdb/_proc/getIndicators
Request Body:
{ "app_name": "sbet", "params": [ { "name": "minYear", "param_type": "IN", "value": 2010 }, { "name": "minMonth", "param_type": "IN", "value": 6 }, { "name": "maxYear", "param_type": "IN", "value": 2010 }, { "name": "maxMonth", "param_type": "IN", "value": 12 }, { "name": "indicator", "param_type": "IN", "value": "OPT_INDEX" } ] }
Sample API Response
[ { "monthyear": "2010/12/1", "OPT_INDEX": "92.603" }, { "monthyear": "2010/11/1", "OPT_INDEX": "92.968" }, { "monthyear": "2010/10/1", "OPT_INDEX": "91.598" }, { "monthyear": "2010/9/1", "OPT_INDEX": "89.041" }, { "monthyear": "2010/8/1", "OPT_INDEX": "88.676" }, { "monthyear": "2010/7/1", "OPT_INDEX": "88.584" }, { "monthyear": "2010/6/1", "OPT_INDEX": "89.589" } ]
Available SBET Procedures
getIndicators
The getIndicators procedure returns monthly time series of seasonal adjusted values for the Small Business Optimism Index and its components.
Request Format
POST http://open.api.nfib-sbet.org/rest/sbetdb/_proc/getIndicators
This request expects the following HEADER parameters in the following order:
- minYear – The starting year (yyyy) of the time series range.
- It can take values from 1974 to 2015
- minMonth – The starting month (m) of the time series range.
- It can take values from 1 to 12
- maxYear – The ending year (yyyy) of the time series range.
- It can take values from 1974 to 2015
- maxMonth – The ending month (m) of the time series range.
- It can take values from 1 to 12
- indicator – The selected indicator for the time series.
- It can take the following values (multiple values are allowed using a comma “,”):
- “OPT_INDEX” – for Small Business Optimism
- “expand_employ” – for Plans to Increase Employment
- “plan_capital” – for Plans to Make Capital Outlays
- “plan_invent” – for Plans to Increase Inventories
- “expected_bus_cond” – for Expect Economy to Improve
- “expected_real” – for Expect Real Sales Higher
- “invent” – for Current Inventory
- “job_openings” – for Current Job Openings
- “expected_cred_cond” – for Expected Credit Conditions
- “good_time_expand” – for Now a Good Time to Expand
- “past_earn” – for Earnings Trends
- It can take the following values (multiple values are allowed using a comma “,”):
Rules
- All parameters are required
- minYear should be less than or equal to maxYear
- minMonth should be less than or equal to maxMonth
Response Format
The getIndicators returns the following fields depending on what index component was requested:
- “monthyear” – Date format yyyy/mm/dd
- “OPT_INDEX” – Value of the index
- ……….
- “past_earn” – Value of the index
Example 1
To request the Current Job Openings Index Component from January 2000 to June 2000:
POST http://open.api.nfib-sbet.org/rest/sbetdb/_proc/getIndicators { "app_name": "sbet", "params": [ { "name": "minYear", "param_type": "IN", "value": 2000 }, { "name": "minMonth", "param_type": "IN", "value": 1 }, { "name": "maxYear", "param_type": "IN", "value": 2000 }, { "name": "maxMonth", "param_type": "IN", "value": 12 }, { "name": "indicator", "param_type": "IN", "value": "job_openings" } ]
The response will be the following:
[ { "monthyear": "2000/12/1", "job_openings": "32" }, { "monthyear": "2000/11/1", "job_openings": "36" }, { "monthyear": "2000/10/1", "job_openings": "32" }, { "monthyear": "2000/9/1", "job_openings": "33" }, { "monthyear": "2000/8/1", "job_openings": "34" }, { "monthyear": "2000/7/1", "job_openings": "33" }, { "monthyear": "2000/6/1", "job_openings": "34" }, { "monthyear": "2000/5/1", "job_openings": "34" }, { "monthyear": "2000/4/1", "job_openings": "32" }, { "monthyear": "2000/3/1", "job_openings": "33" }, { "monthyear": "2000/2/1", "job_openings": "31" }, { "monthyear": "2000/1/1", "job_openings": "31" } ]
Example 2
To request all indicators for January 2015:
POST http://open.api.nfib-sbet.org/rest/sbetdb/_proc/getIndicators { "app_name": "sbet", "params": [ { "name": "minYear", "param_type": "IN", "value": 2015}, { "name": "minMonth", "param_type": "IN", "value": 1 }, { "name": "maxYear", "param_type": "IN", "value": 2015}, { "name": "maxMonth", "param_type": "IN", "value": 1}, { "name": "indicator", "param_type": "IN", "value": “OPT_INDEX,expand_employ,plan_capital,plan_invent,expected_bus_cond,expected_real_sales,invent,job_openings ,expected_cred_cond,good_time_expand,past_earn” } ] }
The response will be the following:
[ { "monthyear": "2015/1/1", "OPT_INDEX": "97.9", "expand_employ": "13", "plan_capital": "25", "plan_invent": "3", "expected_bus_cond": "1", "expected_real_sales": "14", "invent": "-1", "job_openings": "26", "expected_cred_cond": "-5", "good_time_expand": "13", "past_earn": "-17" } ]