NAV Navigation
Shell HTTP JavaScript Node.js Ruby Python Java Go PHP

Carbonio Notification Push Api v0.1.1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Carbonio Notification Push HTTP APIs definition.

Base URLs:

Email: Support

Tokens

registerToken

Code samples

# You can also use wget
curl -X PUT http://localhost:10000/tokens \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

PUT /tokens

Register a token for the specified app and device type

Registers a token for the specified app and device type (Android or iOS). The request must contain the userId, deviceId, app, deviceType and the token which will be used to send push notifications.

Body parameter

{
  "userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b",
  "deviceId": "string",
  "app": "wsc",
  "deviceType": "android",
  "token": "string"
}

Parameters

Name In Type Required Description
body body TokenData true token to be registered

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b",
  "deviceId": "string",
  "app": "wsc",
  "deviceType": "android",
  "token": "string"
}

Responses

Status Meaning Description Schema
200 OK Token is registered successfully TokenData
400 Bad Request The request had wrong or missing parameters None
401 Unauthorized User not authorized None
403 Forbidden The requester could not access the resource None
409 Conflict The request conflict with the current state None

deleteToken

Code samples

# You can also use wget
curl -X DELETE http://localhost:10000/tokens/{tokenId}

DELETE /tokens/{tokenId}

Deletes the specified token

Parameters

Name In Type Required Description
tokenId path string(uuid) true token identifier

Responses

Status Meaning Description Schema
204 No Content Token is deleted successfully None
401 Unauthorized User not authorized None
403 Forbidden The requester could not access the resource None

Notifications

sendNotification

Code samples

# You can also use wget
curl -X POST http://localhost:10000/notifications \
  -H 'Content-Type: application/json'

POST /notifications

Sends notifications to mobile notifications endpoints

Sends mobile notifications to any mobile notifications endpoint allowed. It sends notifications for both FCM and APNS or any of them enabled.

Body parameter

{
  "senderId": "6b2f63ba-164c-48c9-87b1-690cee2b3da3",
  "receiverIds": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ],
  "title": "string",
  "message": "string",
  "data": [
    {
      "field": "string",
      "value": "string"
    }
  ]
}

Parameters

Name In Type Required Description
body body NotificationPayload true notification payload to send

Responses

Status Meaning Description Schema
204 No Content Notification is sent successfully None
400 Bad Request The request had wrong or missing parameters None
401 Unauthorized User not authorized None
403 Forbidden The requester could not access the resource None
409 Conflict The request conflict with the current state None

Schemas

TokenData

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b",
  "deviceId": "string",
  "app": "wsc",
  "deviceType": "android",
  "token": "string"
}

user's token to be registered

Properties

Name Type Required Restrictions Description
id string(uuid) false read-only token identifier
userId string(uuid) true none user identifier
deviceId string true none device identifier
app App true none the app name
deviceType DeviceType true none the device type
token string true none Firebase or Apns token for push notifications

App

"wsc"

the app name

Properties

Name Type Required Restrictions Description
anonymous string false none the app name

Enumerated Values

Property Value
anonymous wsc
anonymous wsc-beta

DeviceType

"android"

the device type

Properties

Name Type Required Restrictions Description
anonymous string false none the device type

Enumerated Values

Property Value
anonymous android
anonymous ios

NotificationPayload

{
  "senderId": "6b2f63ba-164c-48c9-87b1-690cee2b3da3",
  "receiverIds": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ],
  "title": "string",
  "message": "string",
  "data": [
    {
      "field": "string",
      "value": "string"
    }
  ]
}

user's notification to send

Properties

Name Type Required Restrictions Description
senderId string(uuid) true none sender user identifier
receiverIds [string] true none list of receiver ids
title string true none notification title to display in the notification
message string true none text message to display in the notification
data [NotificationData] false none useful data for clients related to the notification

NotificationData

{
  "field": "string",
  "value": "string"
}

single notification data

Properties

Name Type Required Restrictions Description
field string true none name of the field
value string true none value related to the field