Checking the Subscription Status of a Topic

You might want to check if the current user is already subscribed to a topic. For example, your application may want to show a "SUBSCRIBE" button for users who have not yet subscribed to a topic and an "UNSUBSCRIBE" button instead for those users who are already subscribed to the topic.

Here is a sample curl execution for checking the subscription status.

curl -v -X GET \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  "https://api-jp.kii.com/api/apps/{APP_ID}/topics/{TOPIC_NAME}/push/subscriptions/users/{USER_ID}"

Basic invocation is the same for other Scenarios. You just need to modify the base URI accordingly (See Push to User Notification for more information).

Kii Cloud will return the following response:

  • Returns a 204 response if the user is subscribed to the topic.
  • Returns a 404 response with the error code TOPIC_NOT_FOUND if the topic does not exist.
  • Returns a 404 response with the error code PUSH_SUBSCRIPTION_NOT_FOUND if the user is not subscribed.