:::

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.epa.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.

API 金鑰信件

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」

資料擷取API線上說明文件1

Step 2:Click the dataset that you would like to access data, and then click “Try it out”

點擊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”.

可使用此圖之三項參數。填入參數後,點擊「Execute」

Step 4:Then you can get API URL. API URL is shown as below:
https://data.epa.gov.tw/api/v2/aqx_p_432?offset=0&limit=1000&api_key=your-api-key


(2) API Parameters

API URL format:
https://data.epa.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:
[年_月]打包資料方式

1. Download structural data with API argument “year_month”(a.k.a “yyyy_mm”):
https://data.epa.gov.tw/api/v2/aqx_p_185?format=json&limit=5&year_month=2019_03&api_key=f8146***-****-****-****-******ef87b9

2. In the dataset page, click and download the icon of zipped file as shown above:
http://opendata2.epa.gov.tw/data/aqx_p_185/aqx_p_185_2019-03.zip