subscription
資源包含 YouTube 使用者訂閱的相關資訊。訂閱功能會在頻道新增影片,或使用者在 YouTube 上執行特定動作 (例如上傳影片、評分或留言) 時通知使用者。
方法
這個 API 支援 subscriptions
資源的下列方法:
資源表示法
下列 JSON 結構顯示 subscriptions
資源的格式:
{ "kind": "youtube#subscription", "etag": etag, "id": string, "snippet": { "publishedAt": datetime, "channelTitle": string, "title": string, "description": string, "resourceId": { "kind": string, "channelId": string, }, "channelId": string, "thumbnails": { (key): { "url": string, "width": unsigned integer, "height": unsigned integer } } }, "contentDetails": { "totalItemCount": unsigned integer, "newItemCount": unsigned integer, "activityType": string }, "subscriberSnippet": { "title": string, "description": string, "channelId": string, "thumbnails": { (key): { "url": string, "width": unsigned integer, "height": unsigned integer } } } }
屬性
下表定義這個資源中顯示的屬性:
屬性 | |
---|---|
kind |
string 識別 API 資源的類型。值為 youtube#subscription 。 |
etag |
etag 這項資源的 Etag。 |
id |
string YouTube 用於識別訂閱項目的專屬 ID。 |
snippet |
object snippet 物件包含訂閱的基本詳細資料,包括標題和使用者訂閱的頻道。 |
snippet.publishedAt |
datetime 訂閱方案的建立日期和時間。值以 ISO 8601 格式指定。 |
snippet.title |
string 訂閱項目的標題。 |
snippet.description |
string 訂閱詳細資料。 |
snippet.resourceId |
object id 物件包含使用者訂閱的頻道相關資訊。 |
snippet.resourceId.kind |
string API 資源的類型。 |
snippet.resourceId.channelId |
string YouTube 用來識別使用者訂閱頻道的專屬值。 |
snippet.channelId |
string YouTube 用來專屬識別訂閱者頻道的 ID。 resource_id 物件會識別使用者訂閱的頻道。 |
snippet.thumbnails |
object 與訂閱項目相關聯的縮圖地圖。地圖中的每個物件,其鍵都是縮圖圖片的名稱,值則是包含縮圖其他資訊的物件。 |
snippet.thumbnails.(key) |
object 有效鍵值如下:
|
snippet.thumbnails.(key).url |
string 圖片的網址。 |
snippet.thumbnails.(key).width |
unsigned integer 圖片寬度。 |
snippet.thumbnails.(key).height |
unsigned integer 圖片的高度。 |
contentDetails |
object contentDetails 物件包含訂閱方案的基本統計資料。 |
contentDetails.totalItemCount |
unsigned integer 訂閱項目指向的項目概略數量。 |
contentDetails.newItemCount |
unsigned integer 自上次讀取內容後,訂閱項目中的新項目數量。 |
contentDetails.activityType |
string 這項訂閱服務適用的活動類型 (僅限上傳、所有活動)。 這個屬性的有效值如下:
|
subscriberSnippet |
object subscriberSnippet 物件包含訂閱者的基本詳細資料。 |
subscriberSnippet.title |
string 訂閱者頻道的名稱。 |
subscriberSnippet.description |
string 訂閱者頻道的說明。 |
subscriberSnippet.channelId |
string YouTube 指派的 ID,用來唯一識別訂閱者的頻道。 |
subscriberSnippet.thumbnails |
object 訂閱者頻道的縮圖。 |
subscriberSnippet.thumbnails.(key) |
object 有效鍵值如下:
|
subscriberSnippet.thumbnails.(key).url |
string 圖片的網址。 |
subscriberSnippet.thumbnails.(key).width |
unsigned integer 圖片寬度。 |
subscriberSnippet.thumbnails.(key).height |
unsigned integer 圖片的高度。 |