Skip to content

diwise/api-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-notify

Api for supporting subscriptions and notifications

API

GET /subscriptions
POST /subscriptions
GET /subscriptions/{subscriptionId}
PUT /subscriptions/{subscriptionId}
DELETE /subscriptions/{subscriptionId}

Quirks

CrateDB container fails to start with vm heap memory error - sysctl -w vm.max_map_count=262144 in the host should fix it.

Examples

Add subscription

POST to /subscriptions with body

{
  "entities": [
    {
      "id": "string",
      "type": "string",
      "idPattern": "string"
    },
     {
      "id": "str2",
      "type": "Device",
      "idPattern": "*.??"
    }   
  ],
  "name": "sub2",
  "description": "string",
  "watchedAttributes": [
    "string"
  ],
  "timeInterval": 0,
  "expires": "2021-06-17T12:19:13.877Z",
  "isActive": true,
  "throttling": 0,
  "q": "string",

  "csf": "string",
  "id": "sub2",
  "type": "Subscription",
  "notification": {
    "attributes": [
      "string"
    ],
    "format": "string",
    "endpoint": {
      "uri": "http://localhost:8668/v2/notify",
      "accept": "application/json"
    },
    "status": "ok",
    "timesSent": 0,
    "lastNotification": "2021-06-17T12:19:13.877Z",
    "lastFailure": "2021-06-17T12:19:13.877Z",
    "lastSuccess": "2021-06-17T12:19:13.877Z"
  },
  "status": "active",
  "createdAt": "2021-06-17T12:19:13.877Z",
  "modifiedAt": "2021-06-17T12:19:13.877Z"
}

Id: Id for Subscription. If exists the subscription will be updated

entities: What entities should the subscription create notifications for. Equal ID or equal type is implementetd.