The KKBOX Open API zh-TW Developer Hub

Welcome to the KKBOX Open API zh-TW developer hub. You'll find comprehensive guides and documentation to help you start working with KKBOX Open API zh-TW as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

開始使用

Step 1. 建立 App 並獲得 Client ID 及 Client Secret

請至 KKBOX 開發者網站 建立一個 App 並獲得 Client ID 及 Client Secret。

Step 2. 獲取 Access Token

您可以透過 KKBOX OAuth 2.0 Token API 來獲得 Access Token。

Token API for Client Credentials Flow Request

POST /oauth2/token HTTP/1.1
Host: account.kkbox.com
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id={YOUR_CLIENT_ID}&client_secret={YOUR_CLIENT_SECRET}

使用 Command Line Tool

curl -d "grant_type=client_credentials&&client_id={YOUR_CLIENT_ID}&client_secret={YOUR_CLIENT_SECRET}" https://account.kkbox.com/oauth2/token
{
  "access_token": "fCVTwABPlcO6Qxc7Ll23rsdfsf",
  "expires_in": 1492982700,
  "token_type": "Bearer"
}

Step 3. 從 KKBOX APIs 取得資料

若要從 KKBOX APIs 取得資料,您必須在 HTTP Header 中加入 “Authorization: Bearer {YOUR_ACCESS_TOKEN}”。以 Search API 為例。

KKBOX Search API Request

GET /v1.1/search?q=為你我受冷風吹&type=track&territory=TW HTTP/1.1
Host: api.kkbox.com
Authorization: Bearer fCVTwABPlcO6Qxc7Ll23rsdfsf

使用 Command Line Tool

curl --header "Authorization: Bearer fCVTwABPlcO6Qxc7Ll23rsdfsf" "https://api.kkbox.com/v1.1/search?q=為你我受冷風吹&type=track&territory=TW"

KKBOX Search API Response

{
  "tracks": {...},
  "paging": {...},
  "summary": {...}
}

開始使用


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.