Paradigm
1、Get API Key by registering
(1) This platform offers data access through API. Since we have membership mechanism, you need to use and API Key to access our Open Data.
(2) After registering
( https://data.moenv.gov.tw/api_term)
, this website will send you an email of membership API key.
(3) Please store your API key and keep it secure.
2、Documents of API parameters description and Python and R Language examples, please find in the following link: https://reurl.cc/W3oAzk
.
3、Access data through “API Documentation”
(1) Get API URL with “API Documentation”Step 1:Click「Development Guide」>「API Documentation」
Step 2:Click the dataset that you would like to access data, and then click “Try it out”
Step 3:There are different parameters with each datasets. Take dataset below for example, there are three available API parameters, as shown below. Fill in parameters and then click “Execute”.
Step 4:Then you can get API URL. API URL is shown as below:
https://data.moenv.gov.tw/api/v2/aqx_p_432?offset=0&limit=1000&api_key=your-api-key
(2) API Parameters
API URL format:
https://data.moenv.gov.tw/api/v2/{DataID}?format={format}&year_month={yyyy_mm}&offset={offset}&limit={limit}&api_key={api-key}
{DataID} | Identifier of data resource. You can get it in ”API Documentation“, shown as above figure in Step 4. |
---|---|
{limit} | Number of data to access. Please fill in a number. |
{offset} | Number of data to skip. Please fill in a number. |
{api_key} | The authentication code to access data, you can get one by registering. |
{sort} | The field to sort data. |
{format} | Data format. Please fill in json, xml, or csv. |
{yyyy_mm} | Please fill in historical data time, such as 2020_01. Would get the latest data if not filled in. |
{DataID} |
(3) Download [Year_Month] wrapped data: