APIs
API Documentation:
Detailed API information present in this Reference - API Document
Example:
Group Notification will use the new notification create API to create notifications as defined in the document Notification Design Discussion.
This API allows to send email, sms, device and feed type notifications. This will only be accessible internally by different service to send notification. Template configuration needs to be configured to use this service.
sync
application/json
Bearer <key>
OK ! Successful operation. Send Notification operation was successfully executed.
BAD REQUEST. The Send Notifications operation failed ! The possible reason for failure is that you may have missed providing input for a mandatory parameter.
Unauthorized User
INTERNAL SERVER ERROR
POST /api/notification/v2/send HTTP/1.1
Host: staging.sunbirded.org
notification-delivery-mode: sync
ts: text
X-msgid: text
Content-Type: application/json
Authorization: Bearer <key>
Accept: */*
Content-Length: 454
{
"request": {
"notifications": [
{
"ids": [
"12345"
],
"priority": 1,
"type": "feed",
"action": {
"type": "add-member",
"category": "notification-feed",
"template": {
"type": "JSON",
"params": {
"param1": "Math's Activity",
"param2": "Test"
}
},
"createdBy": {
"id": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
"name": "John",
"type": "User"
},
"additionalInfo": {
"group": {
"id": "1234sa34",
"name": "Test"
},
"groupRole": "admin",
"activity": {
"id": "do_12443",
"type": "Course",
"name": "Math's Activity"
}
}
}
}
]
}
}
{
"id": "v2.notification.send",
"ver": "v1",
"ts": "text",
"params": {
"resmsgid": "text",
"msgid": "text",
"err": "text",
"status": "text",
"errmsg": "text"
},
"responseCode": "OK",
"result": {
"response": "SUCCESS"
}
}
This API is used for getting in-App notification of the user
User ID to fetch notifications for
Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully retrieved user notification feed
Unauthorized access
Internal server error
GET /api/notification/v1/feed/read/{userId} HTTP/1.1
Host: staging.sunbirded.org
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
{
"id": "v1.notification.feed.read.1234",
"ver": "v1",
"ts": "1628697563377",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"feeds": [
{
"id": "64ef2ccd-2ec7-4759-b500-590d4a6eccf3",
"userId": "1234",
"category": "notification-feed",
"priority": 1,
"status": "read",
"createdOn": 1628539887611,
"updatedOn": 1628614252986,
"createdBy": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
"updatedBy": "1234",
"action": {
"type": "add-member",
"template": {
"type": "JSON",
"ver": "4.2",
"data": "{\"title\":\"Math's Activity has been added\"}"
},
"createdBy": {
"id": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
"name": "John",
"type": "User"
},
"additionalInfo": {
"group": {
"id": "123434",
"name": "Test"
},
"groupRole": "admin",
"activity": {
"id": "do_12443",
"type": "Course",
"name": "Math's Activity"
}
}
}
}
]
}
}
application/json
Possible values: Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully updated notification status
Bad request - missing or invalid parameters
Unauthorized access
Internal server error
PATCH /api/notification/v1/feed/update HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 78
{
"request": [
{
"ids": [
"64ef2ccd-2ec7-4759-b500-590d4a6eccf3"
],
"userId": "1234"
}
]
}
{
"id": "v1.notification.feed.update",
"ver": "v1",
"ts": "1628697773888",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"response": "SUCCESS"
}
}
application/json
Possible values: Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully deleted notification feed
Bad request
Unauthorized access
Internal server error
PATCH /api/notification/v1/feed/delete HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 98
{
"request": [
{
"ids": [
"64ef2ccd-2ec7-4759-b500-590d4a6eccf3"
],
"userId": "1234",
"category": "groups"
}
]
}
{
"id": "v1.notification.feed.delete",
"ver": "v1",
"ts": "1628697773888",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"response": "SUCCESS"
}
}
application/json
Possible values: Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully created notification template
Bad request
Unauthorized access
Internal server error
POST /api/notification/v1/template/create HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 596
{
"request": {
"ver": "4.4.0",
"data": "{\"title\": \"${param1} has left the ${param2}\"}",
"templateId": "user-exit-2-2",
"type": "JSON",
"config": {
"test": "13231231"
},
"template_schema": "{\n \"$schema\": \"#/definition/params\",\n \"title\": \"params context\",\n \"description\": \"properties Data\",\n \"type\": \"object\",\n \"properties\": {\n \"param1\": {\n \"description\": \"property 1 value\",\n \"type\": \"string\"\n },\n \"param2\": {\n \"description\": \"property 2 value\",\n \"type\": \"string\"\n }\n },\n \"required\": [\"param1\", \"param2\"]\n}\n"
}
}
{
"id": "v1.notification.template.create",
"ver": "v1",
"ts": "1628697773888",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"response": "SUCCESS"
}
}
application/json
Possible values: Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully updated notification template
Bad request
Unauthorized access
Internal server error
PATCH /api/notification/v1/template/update HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 115
{
"request": {
"templateId": "user-exit-2-2",
"ver": "4.4.0",
"data": "{\"title\": \"${param1} has left the ${param2}\"}"
}
}
{
"id": "v1.notification.template.update",
"ver": "v1",
"ts": "1628697773888",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"response": "SUCCESS"
}
}
application/json
Possible values: Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully deleted notification template
Bad request
Unauthorized access
Internal server error
PATCH /api/notification/v1/template/delete HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 42
{
"request": {
"templateId": "user-exit-2-2"
}
}
{
"id": "v1.notification.template.delete",
"ver": "v1",
"ts": "1628697773888",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"response": "SUCCESS"
}
}
Retrieve a list of all notification templates available in the system
Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully retrieved templates
Unauthorized access
Internal server error
GET /api/notification/v1/template/list HTTP/1.1
Host: staging.sunbirded.org
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
{
"id": "v1.notification.template.list",
"ver": "v1",
"ts": "1628697563377",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"templates": [
{
"lastUpdatedBy": "1234",
"createdBy": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
"ver": "4.4.0",
"data": "{\"title\": \"${param1} has left the ${param2}\"}",
"templateId": "user-exit-2-2",
"type": "JSON",
"config": {
"test": "13231231"
},
"template_schema": "{\"$schema\":\"#/definition/params\",\"title\":\"params context\",\"description\":\"properties Data\",\"type\":\"object\",\"properties\":{\"param1\":{\"description\":\"property 1 value\",\"type\":\"string\"},\"param2\":{\"description\":\"property 2 value\",\"type\":\"string\"}},\"required\":[\"param1\",\"param2\"]}\n",
"lastUpdatedOn": null,
"createdOn": 1628696821794
}
]
}
}
Associate a notification template with a specific action
application/json
Possible values: Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully mapped action to template
Invalid request
Unauthorized access
Internal server error
PATCH /api/notification/v1/template/action/update HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 78
{
"request": {
"templateId": "user-exit-2-2",
"action": "member-add",
"type": "Feed"
}
}
{
"id": "v1.notification.template.action.update",
"ver": "v1",
"ts": "1628697773888",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"response": "SUCCESS"
}
}
Retrieve the notification template associated with a specific action
The action to get the mapped template for
member-add
Bearer token for API authorization
Bearer <your-auth-token>
User authentication token
Managed User token for MUA users
Request timestamp
Unique request identifier
Successfully retrieved template for action
Action configuration not found
Unauthorized access
Internal server error
GET /api/notification/v1/template/{action} HTTP/1.1
Host: staging.sunbirded.org
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
{
"id": "v1.notification.template.member-add",
"ver": "v1",
"ts": "1628697563377",
"params": {
"resmsgid": null,
"msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
"err": null,
"status": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"action": "member-add",
"type": "Feed",
"template": {
"lastUpdatedBy": "1234",
"createdBy": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
"ver": "4.4.0",
"data": "{\"title\": \"${param1} has left the ${param2}\"}",
"templateId": "user-exit-2-2",
"type": "JSON",
"config": {
"test": "13231231"
},
"template_schema": "{\"$schema\":\"#/definition/params\",\"title\":\"params context\",\"description\":\"properties Data\",\"type\":\"object\",\"properties\":{\"param1\":{\"description\":\"property 1 value\",\"type\":\"string\"},\"param2\":{\"description\":\"property 2 value\",\"type\":\"string\"}},\"required\":[\"param1\",\"param2\"]}\n",
"lastUpdatedOn": null,
"createdOn": 1628696821794
}
}
}
Last updated
Was this helpful?