sc-notifications

command module
v0.0.0-...-b75766b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

README

khabar

======= Notifications engine

API
  1. Adding a new channel to notification setting

Method: POST

EndPoint: /topic/<notification_ident>/channel/<channel_ident>

Request body :

{
    org:"",
    app_name: "",
    user:"",
    ident:""
}

Response Code: 200

Response Body: If new entity is being created

{
    "body": "[ID of entity created]",
    "message": "Created",
    "status": 201
}

If existing entity is modified

{
    "body": "",
    "message": "NoContent",
    "status": 204
}
  1. Removing a channel from notification setting

Method: DELETE

EndPoint: /topic/<notification_ident>/channel/<channel_ident>

Request body :

{
    org:"",
    app_name: "",
    user:"",
    ident:""
}

Response Code: 200

Response Body:

{
    "body": "",
    "message": "NoContent",
    "status": 204
}
  1. Removing notification setting

Method : DELETE

EndPoint: /topic/<notification_ident>

Request Body:

{
    org:"",
    app_name: "",
    user:"",
    ident:""
}

Response Code: 200

Response Body:

{
    "body": "",
    "message": "NoContent",
    "status": 204
}
  1. Get all notification settings

Method : GET

EndPoint: /topics

Request Filteting: app_name org user

Response Code: 200

Response Body:

 [
        {
            "_id": "",
            "created_on": 1425547531188,
            "updated_on": 1425879125700,
            "user": "",
            "org": "",
            "app_name": "",
            "channels": [
                "",
                ""
            ],
            "ident": ""
        }
]
  1. Get all channels

Method : GET

EndPoint: /channels

Request Filteting: app_name org user

Response Code: 200

Response Body:

 [
        {
            "_id": "",
            "created_on": 1425545240236,
            "updated_on": 1425545240236,
            "user": "",
            "org": "",
            "app_name": "",
            "data": {
            },
            "ident": ""
        }
]
  1. Get all notifications

This will be polled periodically

Method: GET

Endpoint: /notifications

Query params: user, org (this information is already known to the api via the request, so not necessarily needed)

Response Code: 200

Response Body:

[
  {
    org:"",
    app_name: "",
    user:"",
    destination_uri:"",
    text:"",
    topic:"",
    destination_uri:"",
    is_read:false,
    created_on: <milliseconds_since_epoch>
   },
  { _id: 2,... }
]
  1. Mark a single notification as read

Method: PUT

Endpoint: /notification/:_id

Response code: 200

Response Body:

{
    "body": "",
    "message": "NoContent",
    "status": 204
}
  1. Mark all unread notifications as read

Method: PUT

Endpoint: /notifications

Response code: 200

Response Body:

{
    "body": "",
    "message": "NoContent",
    "status": 204
}

destination_uri is the link to relevant entity. (i.e action, incident) text is the notification text topic is the topic of notification (i.e incident_title_changed)

Note For all of the above request you must pass atleast one of the org, app_name and user. ident denotes the notification type (e.g incident_title_changed)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL