文件
APIAPI 參考

網站

列出、建立、讀取、更新和刪除網站。

GET/api/v1/sites

列出網站

Lists the team's sites that the API key can access, in pages of up to 200.

權限範圍site:read
查詢參數
limitinteger

Maximum number of results per page.

預設 1001–200
cursorstring | 任意 | null

Opaque pagination cursor from the previous response.

回應
POST/api/v1/sites

建立網站

Creates a site in the team and returns it. Install the tracking script from Get tracking script to start collecting data.

權限範圍site:write
請求主體application/json
namestring必填

Display name of the site.

1–120 chars
domainstring必填

Domain of the website, without protocol, e.g. example.com.

1–255 chars
publicEnabledboolean必填

Whether the public shared dashboard is enabled.

預設 false
publicSlugstring

Slug of the public dashboard URL. Omit it to have one generated.

≤ 120 chars
回應
GET/api/v1/sites/{siteId}

取得網站

Returns one site.

權限範圍site:read
路徑參數
siteIdstring必填

ID of the site (see List sites).

1–256 chars
回應
PATCH/api/v1/sites/{siteId}

更新網站

Updates a site's name, domain, or public sharing. Send only the fields to change; at least one is required.

權限範圍site:write
路徑參數
siteIdstring必填

ID of the site (see List sites).

1–256 chars
請求主體application/json
namestring
1–120 chars
domainstring
1–255 chars
publicEnabledboolean
publicSlugstring
≤ 120 chars
回應
DELETE/api/v1/sites/{siteId}

刪除網站

Deletes the site and all of its analytics data. This cannot be undone.

權限範圍site:write
路徑參數
siteIdstring必填

ID of the site (see List sites).

1–256 chars
回應