Unsubscribing from a Bucket

You can unsubscribe from a bucket to stop receiving a push notification when a change occurs in the bucket.

The following command unsubscribes a user from a bucket in the application scope.

curl -v -X DELETE \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  "https://api.kii.com/api/apps/{APP_ID}/buckets/{BUCKET_ID}/filters/all/push/subscriptions/users/{TARGET_USER_ID}" \
  -d ""

The following command unsubscribes a user from a bucket in a group scope.

curl -v -X DELETE \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  "https://api.kii.com/api/apps/{APP_ID}/groups/{GROUP_ID}/buckets/{BUCKET_ID}/filters/all/push/subscriptions/users/{TARGET_USER_ID}" \
  -d ""

The following command unsubscribes a user from a bucket in a user scope.

curl -v -X DELETE \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  "https://api.kii.com/api/apps/{APP_ID}/users/{USER_ID}/buckets/{BUCKET_ID}/filters/all/push/subscriptions/users/{TARGET_USER_ID}" \
  -d ""

For all the cases, make sure to replace {APP_ID} with your application's AppID and {TARGET_USER_ID} with the target user's ID. Also, {ACCESS_TOKEN} must be the target user's token or the app admin token.

Unlike when subscribing a user to a bucket, TARGET_USER_ID cannot be omitted even though the subscriber is the owner of ACCESS_TOKEN.

Kii Cloud returns one of these responses:

  • A 204 response if the unsubscription is successful.
  • A 404 response with the error code FILTER_NOT_FOUND if the specified bucket does not exist.
  • A 404 response with the error code PUSH_SUBSCRIPTION_NOT_FOUND if the specified bucket is not subscribed to.