Welcome to the EasyData APIs/Data Services
EasyData offers programmatic access to data and metadata through web services, APIs that allow machine-to-machine communication. EasyData API provides users an easy yet powerful way to retrieve data and metadata at series level and use it in their programs.
What are the pre-requisites to use EasyData APIs?
Users need to have an active user account and an API Key to use EasyData APIs. The API Key is valid for 90 days, after which it needs to be regenerated.
How to get API Key?
Users can obtain API Key by following the steps given below:
- Go to 'My Data Basket' option available at the top right of your screen.
- Go to Login tab shown at the top left of your screen.
- Enter your registered email address and password in the given boxes.
- Press Submit.
- Go to My Account tab shown at the top left of your screen.
- Press Generate API Key.
- API Key is now available on same screen with its Start and End Date.
API Call Rate Limits
Following limits are placed on the number of API requests for each API Key:
- Daily Limit: 2,000 requests per day
- Hourly Limit: 250 requests per hour
The limits are applied across all API calls.
Which APIs are available?
Presently, EasyData offers following APIs to download both data and metadata at series and dataset level:
1. Getting series data
2. Getting series metadata
3. Getting dataset metadata
1. Getting series data
This API is used to retrieve series data in desired format (csv or json). Default is json.
HTTP Request (GET): https://easydata.sbp.org.pk/api/v1/series/[series_key]/data?[parameter-list]
where [series_key] is fully qualified series key of desire indicator/variable, and [parameter-list] is a list of standard HTTP GET request parameter. Below is the list of parameters applicable for this API:
Query Parameters
Parameter |
Mandatory |
Type (format) |
Default |
Description |
api_key |
yes |
string |
none |
API key can be generated from My Data Basket under My Account after login. |
start_date |
no |
ISO Date (YYYY-MM-DD) |
none |
The start of a date range when requesting data for a range of dates. If both start_date and end_date are not specified, the API will return only the most recent observation. |
end_date |
no |
ISO Date (YYYY-MM-DD) |
Today |
The end of the date range, when requesting data for a range of dates. If both start_date and end_date are not specified, the API will return only the most recent observation. |
format |
no |
string |
json |
'json' is the default format; 'csv' is also supported. |
Python Example
import requests
res = requests.get("https://easydata.sbp.org.pk/api/v1/series/TS_GP_BOP_WR_M.WR0010/data?api_key="+
"FE72FE1E90D209A8AAB3E8DC83B9B8D49511BCE8" ,verify = False)
print(res.text)
Output : '{"columns": ["Dataset Name", "Series Key", "Series Name", "Observation Date", "Observation Value", "Unit", "Observation Status", "Status Comments"], "rows": [["Country-wise Workers\' Remittances", "TS_GP_BOP_WR_M.WR0010", "Total Cash inflow of Workers\' remittances in Pakistan in a month", "2022-07-31", "2523.753816", "Million USD", "Normal", ""]]}'
R Example
api_key <- "FE72FE1E90D209A8AAB3E8DC83B9B8D49511BCE8"
download.file(
url = paste0(
"https://easydata.sbp.org.pk/api/v1/series/TS_GP_BOP_WR_M.WR0010/data?api_key=",
api_key
),
destfile = "output.json",
mode = "wb",
method = "curl"
)
2. Getting series metadata
This API is used to get series metadata in desired format (csv or json), default format is json.
HTTP Request (GET): https://easydata.sbp.org.pk/api/v1/series/[series_key]/meta?[parameter-list]
where [series_key] is fully qualified series key of desire indicator/variable, and [parameter-list] is a list of standard HTTP GET request parameter. Below is the list of parameters applicable for this API:
Query Parameters
Parameter |
Mandatory |
Type (format) |
Default |
Description |
api_key |
yes |
string |
none |
API key can be generated from Account Details under My Account after login. |
format |
no |
string |
json |
'json' is the default format; 'csv' is also supported. |
3. Getting dataset metadata
This API is used to get dataset metadata in desired format (csv or json), default format is json.
HTTP Request (GET): https://easydata.sbp.org.pk/api/v1/dataset/[dataset_code]/meta?[parameter-list]
where [dataset_code] is fully qualified dataset code of desire indicator/variable, and [parameter-list] is a list of standard HTTP GET request parameter. Below is the list of parameters applicable for this API:
Query Parameters
Parameter
|
Mandatory
|
Type (format)
|
Default
|
Description
|
api_key
|
yes
|
string
|
none
|
API key can be generated from Account Details under My Account after login.
|
format
|
no
|
string
|
json
|
'json' is the default format; 'csv' is also supported.
|
|