GetReader
GetReader
可讓發布商驗證擁有已知 PPID 的讀者是否已將其訂閱方案連結至 Google。發布商使用 GET
要求時,可查詢屬於特定出版品 ID 的 PPID。
要求
//GET /v1/publications/dailybugle.com/readers/6789
回應
端點會傳回 200 的 200,其中 JSON 主體包含已連結訂閱項目的 created_time
;如果發布作業找不到 PPID,則會傳回錯誤。詳情請參閱錯誤一節。
{
"name": "publications/gtech-demo.appspot.com/readers/81112",
"create_time": "2022-04-19T04:53:40+00:00"
}
GetReaderEntitlements
GetReaderEntitlements
可讓發布商查詢發布商先前提供的 PPID 授權。發布商使用 GET 要求時,會提供 PPID 和發布 ID 來要求授權。
要求
//GET /v1/publications/dailybugle.com/readers/6789/entitlements
回應
如果要求成功,傳回格式會與使用 UpdateReaderEntitlements
PATCH
要求儲存授權的格式相同。
{
"name": "publications/dailybugle.com/readers/6789/entitlements",
"entitlements": [
{
"product_id": "dailybugle.com:basic",
"subscription_token": "dnabhdufbwinkjanvejskenfw",
"detail": "This is our basic plan",
"expire_time": "2022-08-19T04:53:40+00:00"
},
{
"product_id": "dailybugle.com:premium",
"subscription_token": "wfwhddgdgnkhngfw",
"detail": "This is our premium plan",
"expire_time": "2022-07-19T04:53:40+00:00"
},
{
"product_id": "dailybugle.com:deluxe",
"subscription_token": "fefcbwinkjanvejfefw",
"detail": "This is our deluxe plan",
"expire_time": "2022-08-20T04:53:40+00:00"
}
]
}
如果使用者沒有授權但已連結 PPID (例如已過期並遭到清除),授權要求會在標準授權物件中傳回空白的授權陣列。
{
"name": "publications/dailybugle.com/readers/6789/entitlements",
"createTime": "2023-02-07T17:38:57.425577Z"
}
UpdateReaderEntitlements
UpdateReaderEntitlements
是用來根據 PPID 建立及更新讀取器的授權。
這個酬載範例可讓讀者取得 PPID 6789 的授權,進而享有 The Daily Bugle 的三種產品 ID:dailybugle.com:basic
、dailybugle.com:premium
和 dailybugle.com:deluxe
。如果讀者 6789 之後使用 Google 平台提供搜尋和探索服務,「來自你訂閱的內容」清單會顯示來自 Dailybugle.com 文章的所有相關結果,並標記這些產品 ID。
要求
//PATCH /v1/publications/dailybugle.com/readers/6789/entitlements
{
"name": "publications/dailybugle.com/readers/6789/entitlements",
"entitlements": [
{
"product_id": "dailybugle.com:basic",
"subscription_token": "dnabhdufbwinkjanvejskenfw",
"detail": "This is our basic plan",
"expire_time": "2022-08-19T04:53:40+00:00"
},
{
"product_id": "dailybugle.com:premium",
"subscription_token": "wfwhddgdgnkhngfw",
"detail": "This is our premium plan",
"expire_time": "2022-07-19T04:53:40+00:00"
},
{
"product_id": "dailybugle.com:deluxe",
"subscription_token": "fefcbwinkjanvejfefw",
"detail": "This is our deluxe plan",
"expire_time": "2022-08-20T04:53:40+00:00"
}
]
}
回應
如果 PATCH 作業成功,系統會傳回已儲存的 entitlements
物件,格式與 GetReaderEntitlements
相同。
DeleteReader
DeleteReader
可讓發布者手動刪除讀者連結的訂閱方案。發布商使用 DELETE
要求來提交 PPID,做為要刪除的出版品 ID。
要求
//DELETE /v1/publications/dailybugle.com/readers/6789
回應
如果刪除成功,會傳回 200 含空白 JSON 物件 {}
。
{}