GetReader
GetReader 를 사용하면 게시자가 알려진 PPID가 있는 독자 중 한 명이 구독을 Google에 연결했는지 확인할 수 있습니다. 게시자는 GET 요청을 사용하여 특정 Publication ID에 속하는 PPID를 쿼리합니다.
요청
REST API: GET 요청
https://readerrevenuesubscriptionlinking.googleapis.com/v1/publications/publicationId/readers/ppid
클라이언트 라이브러리 (Node.js)
async function getReader(ppid) {
const publicationId = process.env.PUBLICATION_ID;
return await client.publications.readers.get({
name: `publications/${publicationId}/readers/${ppid}`,
});
};
응답
엔드포인트는 연결된 구독의
created_time이 포함된 JSON 본문이 있는 200 또는 Publication에 대한 PPID가 없는 경우 오류를 반환합니다. 자세한 내용은 오류 섹션을 참고하세요.
{
"name": "publications/CAowqfCKCw/readers/22553",
"createTime": "2025-07-30T18:26:58.050224Z",
"publicationId": "CAowqfCKCw",
"ppid": "22553",
"originatingPublicationId": "CAowqfCKCw"
}
GetReaderEntitlements
GetReaderEntitlements 를 사용하면 게시자가 이전에 제공한 PPID의 권한을 쿼리할 수 있습니다. 게시자는 GET 요청을 사용하여 PPID와 Publication ID를 제공하여 권한을 요청합니다.
요청
REST API: GET 요청
https://readerrevenuesubscriptionlinking.googleapis.com/v1/publications/publicationId/readers/ppid/entitlements
클라이언트 라이브러리 (Node.js)
async function getReaderEntitlements(ppid) {
const publicationId = process.env.PUBLICATION_ID;
return await client.publications.readers.getEntitlements({
name: `publications/${publicationId}/readers/${ppid}/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"
}
UpdateReaderEntitlements
UpdateReaderEntitlements 는 PPID를 기반으로 독자의 권한을 만들고 업데이트하는 데 사용됩니다.
이 샘플 페이로드는 PPID 6789가 있는 독자에게 The Daily Bugle의 세 가지 제품 ID(dailybugle.com:basic, dailybugle.com:premium, dailybugle.com:deluxe)에 대한 권한을 부여합니다. 독자 6789가 이후에 검색 및 탐색에 Google 서피스를 사용하면 '내 구독' 목록에 이러한 제품 ID로 태그가 지정된 dailybugle.com 기사의 관련 결과가 표시됩니다.
요청
REST API: PATCH 요청
https://readerrevenuesubscriptionlinking.googleapis.com/v1/publications/publicationId/readers/ppid/entitlements
요청 본문: entitlements 객체에 관한 자세한 내용은
용어집
페이지를 참고하세요.
{
entitlements : [{
product_id: `${publicationId}:basic`,
subscription_token: 'abc1234',
detail: 'This is our basic plan',
expire_time: '2025-10-21T03:05:08.200564Z'
}]
}
클라이언트 라이브러리 (Node.js)
async function updateReaderEntitlements(ppid) {
const publicationId = process.env.PUBLICATION_ID;
const requestBody = {
entitlements : [{
product_id: `${publicationId}:basic`,
subscription_token: 'abc1234',
detail: 'This is our basic plan',
expire_time: '2025-10-21T03:05:08.200564Z'
}]
};
return await client.publications.readers.updateEntitlements({
name: `publications/${publicationId}/readers/${ppid}/entitlements`,
requestBody
});
}
응답
PATCH 작업이 성공하면 저장된 entitlements 객체가
반환됩니다. 형식은 GetReaderEntitlements와 동일합니다.
DeleteReader
DeleteReader를 사용하면 게시자가 연결된 구독을 수동으로 삭제할 수 있습니다.
게시자는 DELETE 요청을 사용하여 삭제할 Publication ID의 PPID를 제출합니다.
DeleteReader를 호출하기 전에 먼저 빈 배열({ "entitlements": [] })로 UpdateReaderEntitlements를 사용하여 권한을 삭제하거나 권한이 있는 독자를 삭제해야 하는 경우 선택적 force 매개변수를 true로 설정해야 합니다.
force 매개변수는 기본적으로 false입니다.
요청
REST API: DELETE 요청
https://readerrevenuesubscriptionlinking.googleapis.com/v1/publications/publicationId/readers/ppid?force={boolean}
클라이언트 라이브러리 (Node.js)
async function deleteReader(ppid, forceDelete = false) {
const publicationId = process.env.PUBLICATION_ID;
return await client.publications.readers.delete({
name: `publications/${publicationId}/readers/${ppid}`,
force: forceDelete
});
}
응답
삭제에 성공하면 빈 JSON 객체 {}가 포함된 200이 반환됩니다.
{}