GetReader
借助 GetReader
,发布商可以验证其拥有已知 PPID 的读者是否已将其订阅与 Google 相关联。发布商使用 GET
请求查询属于特定发布商 ID 的 PPID。
请求
//GET /v1/publications/dailybugle.com/readers/6789
响应
如果未找到相应发布内容的 PPID,该端点将返回 200 和包含关联订阅的 created_time
的 JSON 正文,否则会返回错误。如需了解详情,请参阅“错误”部分。
{
"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 搜索和 Google 探索时,“您的订阅”列表中会显示带有任何这些商品 ID 的 dailybugle.com 文章中的所有相关结果。
请求
//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
请求提交要删除的出版物 ID 的 PPID。
请求
//DELETE /v1/publications/dailybugle.com/readers/6789
响应
成功删除时,系统会返回 200 和空的 JSON 对象 {}
。
{}