Subscribed user

Location /api/apps/{appID}/things/{thingID}/buckets/{bucketID}/filters/{filterID}/push/subscriptions/users/{userID}
This resource represents a user as a subscriber to the current filter.

Request Headers (Applies to all methods)

Authorization
header
Required: Yes

PUT

/api/apps/{appID}/things/{thingID}/buckets/{bucketID}/filters/{filterID}/push/subscriptions/users/{userID}

Description

Subscribe this user to the current filter. If the bucket does not exist, the bucket will be created before subscribing the user to it. The user becomes the bucket owner in this case.

Security

Can be performed by the administrator and the user to subscribe himself. The user needs to have the query permission to the bucket where the filter belongs. If the target bucket does not exist, the user also needs to have the bucket creation permission.

Note

This request requires empty body.

Headers
Name Required? type Description
Authorization Yes string Authorization header. OAuth2 Bearer token
URL Params
Name Required? type Description
userID Yes string userID of the subscriber user
Responses
204

Content-Type (None)

The user has been subscribed successfully.
Note This response has no contents.
404

Content-Type application/vnd.kii.UserNotFoundException+json

The user was not found.
Contents
Name Type Description
errorCode string Error code "USER_NOT_FOUND".
message string The error message.
field string The field used for searching the user. This can be the userID or address field.
value string The field value used for searching the user.
appID string The ID of the application.
404

Content-Type application/vnd.kii.ThingNotFoundException+json

The thing was not found.
Contents
Name Type Description
errorCode string Error code "THING_NOT_FOUND".
message string The error message.
field string The field used for searching the thing. This can be the "thingID" or "vendorThingID" field.
value string The field value used for searching the thing.
appID string The ID of the application.
404

Content-Type application/vnd.kii.FilterNotFoundException+json

The filter was not found.
Contents
Name Type Description
errorCode string Error code "FILTER_NOT_FOUND".
message string The error message.
409

Content-Type application/vnd.kii.PushSubscriptionAlreadyExistsException+json

The user was already subscribed to the filter.
Contents
Name Type Description
errorCode string Error code "PUSH_SUBSCRIPTION_ALREADY_EXISTS".
message string The error message.
topicID string The ID of the topic where the subscription already exists
objectScope ObjectScope The scope of the topic
appID string The ID of the application.
userID string The ID of the user. Only provided for a user-scope bucket.
groupID string The ID of the group. Only provided for a group-scope bucket.
thingID string The ID of the thing. Only provided for a thing-scope bucket.
type string One of "APP", "APP_AND_USER", "APP_AND_GROUP", or "APP_AND_THING".
subject string The subject that is already subscribed to the topic/filter
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

Not authorized to access this method.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).

GET

/api/apps/{appID}/things/{thingID}/buckets/{bucketID}/filters/{filterID}/push/subscriptions/users/{userID}

Description

Check if this user is subscribed to the current filter.

Security

Can be performed by the administrator and the subscribed user himself.

Headers
Name Required? type Description
Authorization Yes string Authorization header. OAuth2 Bearer token
URL Params
Name Required? type Description
userID Yes string userID of the subscriber user
Responses
204

Content-Type (None)

The user is subscribed to the filter.
Note This response has no contents.
404

Content-Type application/vnd.kii.UserNotFoundException+json

The user was not found.
Contents
Name Type Description
errorCode string Error code "USER_NOT_FOUND".
message string The error message.
field string The field used for searching the user. This can be the userID or address field.
value string The field value used for searching the user.
appID string The ID of the application.
404

Content-Type application/vnd.kii.ThingNotFoundException+json

The thing was not found.
Contents
Name Type Description
errorCode string Error code "THING_NOT_FOUND".
message string The error message.
field string The field used for searching the thing. This can be the "thingID" or "vendorThingID" field.
value string The field value used for searching the thing.
appID string The ID of the application.
404

Content-Type application/vnd.kii.FilterNotFoundException+json

The filter was not found.
Contents
Name Type Description
errorCode string Error code "FILTER_NOT_FOUND".
message string The error message.
404

Content-Type application/vnd.kii.PushSubscriptionNotFoundException+json

The subscription was not found, or the user was not subscribed to the filter.
Contents
Name Type Description
errorCode string Error code "PUSH_SUBSCRIPTION_NOT_FOUND".
message string The error message.
topicID string The ID of the topic where the subscription is not found
objectScope ObjectScope The scope of the topic
appID string The ID of the application.
userID string The ID of the user. Only provided for a user-scope bucket.
groupID string The ID of the group. Only provided for a group-scope bucket.
thingID string The ID of the thing. Only provided for a thing-scope bucket.
type string One of "APP", "APP_AND_USER", "APP_AND_GROUP", or "APP_AND_THING".
subject string The subject that is not subscribed to the topic/filter
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

Not authorized to access this method.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).

DELETE

/api/apps/{appID}/things/{thingID}/buckets/{bucketID}/filters/{filterID}/push/subscriptions/users/{userID}

Description

Unsubscribe this user from the current filter.

Security

Can be performed by the administrator and the user to unsubscribe himself.

Headers
Name Required? type Description
Authorization Yes string Authorization header. OAuth2 Bearer token
URL Params
Name Required? type Description
userID Yes string userID of the subscriber user
Responses
200

Content-Type (None)

The user has been unsubscribed successfully.
404

Content-Type application/vnd.kii.FilterNotFoundException+json

The filter was not found.
Contents
Name Type Description
errorCode string Error code "FILTER_NOT_FOUND".
message string The error message.
404

Content-Type application/vnd.kii.UserNotFoundException+json

The user was not found.
Contents
Name Type Description
errorCode string Error code "USER_NOT_FOUND".
message string The error message.
field string The field used for searching the user. This can be the userID or address field.
value string The field value used for searching the user.
appID string The ID of the application.
404

Content-Type application/vnd.kii.ThingNotFoundException+json

The thing was not found.
Contents
Name Type Description
errorCode string Error code "THING_NOT_FOUND".
message string The error message.
field string The field used for searching the thing. This can be the "thingID" or "vendorThingID" field.
value string The field value used for searching the thing.
appID string The ID of the application.
404

Content-Type application/vnd.kii.PushSubscriptionNotFoundException+json

The user was not subscribed to the filter.
Contents
Name Type Description
errorCode string Error code "PUSH_SUBSCRIPTION_NOT_FOUND".
message string The error message.
topicID string The ID of the topic where the subscription is not found
objectScope ObjectScope The scope of the topic
appID string The ID of the application.
userID string The ID of the user. Only provided for a user-scope bucket.
groupID string The ID of the group. Only provided for a group-scope bucket.
thingID string The ID of the thing. Only provided for a thing-scope bucket.
type string One of "APP", "APP_AND_USER", "APP_AND_GROUP", or "APP_AND_THING".
subject string The subject that is not subscribed to the topic/filter
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

Not authorized to access this method.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).