Subscribe to an extra view

Motivation

As a client, I want to add a subscription to an existing channel

Functional Design

  • The client initiates PUT /api/v2/apps/{owner}/{app}/notifications/{channelId}/workspaces/{wsid}/subscriptions/{entity}

  • The subscription is added to the channel in addition to existing subscriptions, the client starts receiving notifications about changes in the specified entity.

  • If the subscription already exists, it does nothing

Request headers

Key
Value

Content-Type

application/json

Authorization

Bearer {PrincipalToken}

Parameters

Parameter
Type
Description

Path

owner

string

name of a user who owns the application

app

string

name of an application

wsid

int64

the ID of workspace

channelId

string

the ID of the channel, returned by create channel

entity

string

Subscription entity, see terms

Headers

PrincipalToken

string

Token returned by login

Authorization

  • If entity refers to a view, the client must have read permission for that view in the specified workspace.

Result

Code
Description
Body

200

OK

Channel subscription added

400

Bad Request

401

Unauthorized

403

Forbidden, client has no permissions to read from view

404

Not Found

429

Too may requests, rate limiting

500+

Server errors / service unavailable

Technical design

Components

  • ~cmp.routerAddSubscriptionHandler~✅ function to handle the request in router

    • ~err.routerAddSubscriptionInvalidToken~✅ if the token is invalid or expired

    • ~err.routerAddSubscriptionNoPermissions~❓ if the client has no permissions to read from the specified view

Integration tests

  • ~it.AddSubscription~

Last updated

Was this helpful?