Unsubscribing from a Topic

When a user no longer wants to receive push messages, the user can stop receiving the messages by simply unsubscribing the topic.

See the following example to see how you can unsubscribe a user from an application-scope topic. The same apply to topics in a group or user scope (For the endpoint URLs, see Subscribing to a Topic).

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

Make sure to replace {APP_ID} with your application's AppID and TARGET_USER_ID with the target user's ID. Also make sure to replace {ACCESS_TOKEN} with the target user's token or the app admin token. Modify the base URI accordingly for unsubscribing from a group-scope and user-scope topic (See Push to User Notification for more information).

Kii Cloud will respond as follows:

  • Returns a 200 response if the unsubscibing is successful.
  • Returns a 404 response with the error code TOPIC_NOT_FOUND if the specified topic does not exist.
  • Returns a 404 response with the error code PUSH_SUBSCRIPTION_NOT_FOUND if the user is not subscribed.