API 메서드

GetReader

GetReader를 사용하면 게시자는 알려진 PPID가 있는 리더 중 하나가 구독을 Google에 연결했는지 확인할 수 있습니다. 게시자는 GET 요청을 사용하여 특정 간행물 ID에 속한 PPID를 쿼리합니다.

요청

//GET /v1/publications/dailybugle.com/readers/6789

응답

엔드포인트는 연결된 구독의 created_time가 포함된 JSON 본문에 포함된 200을 반환하거나, 게시에 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가 있는 독자에게 Daily Bugle의 세 가지 제품 ID(dailybugle.com:basic, dailybugle.com:premium, dailybugle.com:deluxe)에 대한 권한을 부여합니다. 6789번 리더가 이후 검색 및 디스커버에 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

응답

삭제에 성공하면 빈 JSON 객체 {}와 함께 200이 반환됩니다.

{}