Notification settings API¶
The notification settings API provides notification settings management capabilities for a web application. The web application can use this API to allow a user to view, update, and remove their notification settings. The Token Server supports the following notification settings: EMAIL, SMS, and NONE.
Lookup value¶
Endpoint: GET /oauth/api/v1/users/{userId}/settings/notification/
Parameter | Description |
---|---|
userId |
identifier of the user |
This endpoint requires basic authentication using valid API client credentials.
When no notification settings is set for a user, but the user does have one or more tokens or consents the default value EMAIL
will be returned as a result.
The notification setting is returned as a JSON response containing the notification type. For users which are unknown because there is no notification setting,
or tokens and consents are missing a 404 Not Found
response is returned.
Attribute | Description |
---|---|
notification_type |
Notification type used to notify the user (SMS / EMAIL / NONE) |
Example result:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"notification_type": "EMAIL"
}
Example error response:
{
"error": "No notification setting found."
}
Set notification setting¶
Endpoint: POST /oauth/api/v1/users/{userId}/settings/notification/{notificationType}
Parameter | Description |
---|---|
userId |
Identifier of the user |
notificationType |
Notification type used to notify the user. Possible values: SMS, EMAIL or NONE. |
This endpoint requires valid API client credentials provided via basic authentication or via url encoded form.
If the user already has a notification setting set, the old value will be overridden. The API returns a 204 No Content
response when the setting was
successfully set.
Example result:
HTTP/1.1 204 No Content
Cache-Control: no-store
Pragma: no-cache
If the notification type was unknown, a 400 Bad Request
is returned, with an error in JSON format.
Example error result:
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"error" : "INVALID_NOTIFICATION_TYPE"
}
Delete notification setting¶
Endpoint: DELETE /oauth/api/v1/users/{userId}/settings/notification/
Parameter | Description |
---|---|
userId |
identifier of the user |
This endpoint requires basic authentication using valid API client credentials.
The API always returns a 204 No Content
response, independent of the execution result.
Example result:
HTTP/1.1 204 No Content
Cache-Control: no-store
Pragma: no-cache