package_list 應用程式介面
開發者可以透過package_list應用程式介面取得完整的數據集目錄:
https://data.gov.hk/tc-data/api/3/action/package_list
package_list
應用程式介面支援兩個可選的參數: limit
和offset
。
limit (int)
: 指定最多可回傳的數據集數量。
offset (int)
: 指定第一個數據集的位置,須與limit一同使用。
例如,當我們想取得英文網站中的第5個至第14個資料集 (索引頭為0),可作以下請求: https://data.gov.hk/en-data/api/3/action/package_list?limit=10&offset=5
以下是應用程式介面所回傳的例子:
{
"help": "Return a list of the names of the site’s datasets (packages).\n\n …",
"result": [
"centaline-centanetod-ccipropertyinfo",
"clp-team1-electric-vehicle-charging-location",
"hk-afcd-afcdlist-pesticides-licensee-1",
"hk-afcd-afcdlist-pesticides-licensee-2",
…
],
"success": true
}
Tip: Dataset IDs returned in the result array can be used in other APIs for further processing. 小提示: 回傳的資料集ID可用於請求其它應用程式介面,以作進一步的處理。