Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

The RESTful API email communication flows between requests submitted and any given result, regardless of a successful or error outcome. Notifications received from the API can be customized by users via the /user/setting/notification resource, which provides an interface to enable or disable emails of the following types with the /user/setting/notification/request:

  • Submission: any PUT, POST, DELETE or PATCH action will trigger an email notification as a summary of the request. Users can enable or disable receiving emails upon any submission.
  • Completion: any PUT, POST, DELETE or PATCH action creates an asynchronous task and the API sends a notification to users summarizing the successful result. Users can enable receiving emails when a request succeeded.
  • Error: any PUT, POST, DELETE or PATCH action creates an asynchronous task and the API sends a notification to users summarizing errors in results. Users can enable receiving just emails when a request has failed.

And customize which notification format /user/setting/notification/format between HTML or TEXT.


Panel

On this page:

Table of Contents
maxLevel2
outlinetrue


The following table shows a brief description and HTTP methods allowed to interact with the user email settings data:

ResourceURIDescriptionGETPOSTPUTDELETEPATCHOPTIONS
Notification format/user/setting/notification/formatNotification format (html or text)(tick)(tick)(tick)
(tick)

(tick)(tick)
Request notification settings/user/setting/notification/requestRequest notification settings(tick) 
(tick) 

(tick)   (tick)










Note

TK stores the Cloud API Token generated as a result of the following POST request to the /auth/request-token resource:

Code Block
curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username>

For example, extracting the token with the jq command:

Code Block
TK=$(curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username> | jq '.token')


List

To list your account notification settings, just do a GET request to /user/setting/notification as follows:

Code Block
languagebash
http GET "https://vss-api.eis.utoronto.ca/v2/user/setting/notification" "Authorization: Bearer $TK"
curl -X GET -H "Authorization: Bearer $TK" "https://vss-api.eis.utoronto.ca/v2/user/setting/notification"

The response would look something like:

Code Block
languagejs
collapsetrue
{
    "_links": {
        "notification_format": "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/format",
        "notification_method": "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/method",
        "notification_request": "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/request",
        "self": "https://vss-api.eis.utoronto.ca/v2/user/setting/notification",
        "settings": "https://vss-api.eis.utoronto.ca/v2/user/setting"
    },
    "data": {
        "format": "text",
        "method": "mail",
        "request": {
            "all": false,
            "completion": true,
            "error": true,
            "none": false,
            "submission": true
        }
    },
    "meta": {
        "count": 3,
        "time": "0.00259s",
        "user": "jm"
    }
}

Disable All request notification 

To disable all request notification (not recommended), submit the following PUT request:

Code Block
languagebash
http PUT "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/request" attribute=none value:=true "Authorization: Bearer $TK"
curl -X PUT -H "Authorization: Bearer $TK" "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/request" -d '{"attribute": "none", "value": True}'


Code Block
languagejs
collapsetrue
{
    "_links": {
        "notification": "https://vss-api.eis.utoronto.ca/v2/user/setting/notification",
        "self": "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/request"
    },
    "data": {
        "all": false,
        "completion": false,
        "error": false,
        "none": true,
        "submission": false
    },
    "meta": {
        "count": 5,
        "time": "0.00196s",
        "user": "jm"
    }
}


Enable All email notification

To enable only all email notification, submit the following PUT requests:

Code Block
languagebash
# httpie
http PUT "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/request" attribute=all value:=true "Authorization: Bearer $TK"

# curl
curl -X PUT -H "Authorization: Bearer $TK" -H "Content-Type: application/json" "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/request" -d '{"attribute": "all", "value": True}'


Code Block
languagejs
collapsetrue
{
    "_links": {
        "notification": "https://vss-api.eis.utoronto.ca/v2/user/setting/notification",
        "self": "https://vss-api.eis.utoronto.ca/v2/user/setting/notification/request"
    },
    "data": {
        "all": true,
        "completion": false,
        "error": false,
        "none": false,
        "submission": false
    },
    "meta": {
        "count": 5,
        "time": "0.00196s",
        "user": "jm"
    }
}