Skip to main content
Version: v5.3

Subscription

The Subscription API allows you to list, create, update, search by ID, and delete subscriptions.

List subscriptions​

Endpoints​

GET platform-notificationsvc/api/v1/subscription

Permissions​

You need the READ action on notificationsvc:subscription:* in each namespace the request acts on.

The namespaces come from the namespaces you name in the request, or from nsfilter when you name none. If neither names a namespace, the request requires the Platform Manager role. For the full model, see Permissions and namespaces.

Request​

Query parameters​

ParameterTypeDescriptionRequired
nsfilterStringNamespaces this request acts within. Repeat the parameter, or separate values with commas, to name more than one. See Permissions and namespaces.Optional
countIntegerMaximum number of subscriptions to return. Defaults to 10.Optional
offsetIntegerIndex of the first result to return. Defaults to 0.Optional
namespacesStringNamespace to match. Repeat the parameter to match more than one.Optional
group.idStringID of the group the subscription belongs to.Optional
device.idStringID of the subscribed device.Optional
nameStringExact name of the subscription to match.Optional
namespacesStringNamespace to match. Repeat the parameter to match more than one.Optional
idsStringID to match. Repeat the parameter to match more than one.Optional
createdAt.afterStringMatch records created after this ISO-8601 timestamp.Optional
createdAt.beforeStringMatch records created before this ISO-8601 timestamp.Optional
updatedAt.afterStringMatch records updated after this ISO-8601 timestamp.Optional
updatedAt.beforeStringMatch records updated before this ISO-8601 timestamp.Optional
typeStringSubscription type: DEVICE or WEBHOOK.Optional

Response​

Codes​

CodeDescription
200Success
400Bad Request
403Forbidden
404Not Found

Response​

{
_offset?: integer
_pageSize?: integer
_total?: integer
_list: {
_id?: string
_group: {
_id?: string
}
_device:#/components/schemas/Ref
_namespaces?: string[]
_status?: enum[CREATED, REQUESTED, ACCEPTED, CANCELLED]
_createdAt?: string
_updatedAt?: string
_requestedAt?: string
_acceptedAt?: string
_cancelledAt?: string
_version?: integer
}[]
}

Create subscription​

Endpoints​

POST platform-notificationsvc/api/v1/subscription

Permissions​

You need the CREATE action on notificationsvc:subscription:* in each namespace the request acts on.

The namespaces come from the namespaces you name in the request, or from nsfilter when you name none. If neither names a namespace, the request requires the Platform Manager role. For the full model, see Permissions and namespaces.

Request​

Query parameters​

ParameterTypeDescriptionRequired
nsfilterStringNamespaces this request acts within. Repeat the parameter, or separate values with commas, to name more than one. See Permissions and namespaces.Optional

Request body​

{
_namespaces?: string[]
_device: {
_id?: string
}
_group:#/components/schemas/Ref
}

Response​

Codes​

CodeDescription
200Success
400Bad Request
403Forbidden
404Not Found
409Conflict

Response​

{
_id?: string
_group: {
_id?: string
}
_device:#/components/schemas/Ref
_namespaces?: string[]
_status?: enum[CREATED, REQUESTED, ACCEPTED, CANCELLED]
_createdAt?: string
_updatedAt?: string
_requestedAt?: string
_acceptedAt?: string
_cancelledAt?: string
_version?: integer
}

Get subscription by ID​

Endpoints​

GET platform-notificationsvc/api/v1/subscription/{id}

Permissions​

You need the READ action on the subscription, which the service checks as notificationsvc:subscription:{id}. A grant on notificationsvc:subscription:* covers every subscription.

The namespaces come from the subscription itself, so a read by ID needs no nsfilter and does not require the Platform Manager role. Sending nsfilter does not bound a read by ID. For the full model, see Permissions and namespaces.

Request​

Query parameters​

ParameterTypeDescriptionRequired
nsfilterStringNamespaces this request acts within. Repeat the parameter, or separate values with commas, to name more than one. See Permissions and namespaces.Optional

Response​

Codes​

CodeDescription
200Success
400Bad Request
403Forbidden
404Not Found

Response​

{
_id?: string
_group: {
_id?: string
}
_device:#/components/schemas/Ref
_namespaces?: string[]
_status?: enum[CREATED, REQUESTED, ACCEPTED, CANCELLED]
_createdAt?: string
_updatedAt?: string
_requestedAt?: string
_acceptedAt?: string
_cancelledAt?: string
_version?: integer
}

Update subscription by ID​

Endpoints​

PUT platform-notificationsvc/api/v1/subscription/{id}

Permissions​

You need the EDIT action on the subscription, which the service checks as notificationsvc:subscription:{id}. A grant on notificationsvc:subscription:* covers every subscription.

The namespaces come from the subscription itself, so the request needs no nsfilter and does not require the Platform Manager role. If you do send nsfilter, it must cover the subscription's namespaces, or the request fails with HTTP 403. For the full model, see Permissions and namespaces.

Request​

Query parameters​

ParameterTypeDescriptionRequired
nsfilterStringNamespaces this request acts within. Repeat the parameter, or separate values with commas, to name more than one. See Permissions and namespaces.Optional
versionIntegerExpected current version of the subscription. The request fails if it does not match.Optional

Request body​

The webhook is the only part of a subscription you can change. Its namespace, group and device are fixed when it is created.

{
_webhook?: {
_method?: string
_url?: string
_query?: { [key: string]: string }
_headers?: { [key: string]: string }
_authorization?: {
_id: string
}
_body?: string
}
}

Response​

Codes​

CodeDescription
200Success
400Bad Request
403Forbidden
404Not Found
409Conflict

Response​

{
_id?: string
_group: {
_id?: string
}
_device:#/components/schemas/Ref
_namespaces?: string[]
_status?: enum[CREATED, REQUESTED, ACCEPTED, CANCELLED]
_createdAt?: string
_updatedAt?: string
_requestedAt?: string
_acceptedAt?: string
_cancelledAt?: string
_version?: integer
}

Patch subscription by ID​

Endpoints​

PATCH platform-notificationsvc/api/v1/subscription/{id}

Permissions​

You need the EDIT action on the subscription, which the service checks as notificationsvc:subscription:{id}. A grant on notificationsvc:subscription:* covers every subscription.

The namespaces come from the subscription itself, so the request needs no nsfilter and does not require the Platform Manager role. If you do send nsfilter, it must cover the subscription's namespaces, or the request fails with HTTP 403. For the full model, see Permissions and namespaces.

Request​

Query parameters​

ParameterTypeDescriptionRequired
nsfilterStringNamespaces this request acts within. Repeat the parameter, or separate values with commas, to name more than one. See Permissions and namespaces.Optional
versionIntegerExpected current version of the subscription. The request fails if it does not match.Optional

Request body​

The webhook is the only part of a subscription you can change. Its namespace, group and device are fixed when it is created. Send only the fields you want to change. Fields you omit keep their current values.

This applies to top-level fields only. A nested object or a list that you do send replaces the stored one outright, rather than merging into it, so send the whole of any nested value you change.

{
_webhook?: {
_method?: string
_url?: string
_query?: { [key: string]: string }
_headers?: { [key: string]: string }
_authorization?: {
_id: string
}
_body?: string
}
}

Response​

Codes​

CodeDescription
200Success
400Bad Request
403Forbidden
404Not Found
409Conflict

Response​

Returns the updated subscription, in the same shape as Get subscription by ID.

Delete subscription by ID​

Endpoints​

DELETE platform-notificationsvc/api/v1/subscription/{id}

Permissions​

You need the DELETE action on the subscription, which the service checks as notificationsvc:subscription:{id}. A grant on notificationsvc:subscription:* covers every subscription.

The namespaces come from the subscription itself, so the request needs no nsfilter and does not require the Platform Manager role. If you do send nsfilter, it must cover the subscription's namespaces, or the request fails with HTTP 403. For the full model, see Permissions and namespaces.

Request​

Query parameters​

ParameterTypeDescriptionRequired
nsfilterStringNamespaces this request acts within. Repeat the parameter, or separate values with commas, to name more than one. See Permissions and namespaces.Optional
versionIntegerExpected current version of the subscription. The request fails if it does not match.Optional

Response​

Codes​

CodeDescription
204No Content
400Bad Request
403Forbidden
404Not Found
409Conflict

Response​

No response body.