CROWDMANAGERCROWDMANAGER

Subscriptions

Description

Subscriptions are used to define endpoints where any push notifications can be sent to by the CROWDMANAGER Push Service. Only subscribtions that have both flags isEnabled and isValidated set to true will receive notifications from CROWDMANAGER.


Fields

Name Description Type/Supported Values Supported Methods
id The Id of the subscription long GET
url The callback url which is used to push the notifications.
It may contain {org} placeholder(s) which will be substituted for the ID of the organization that the pushed data belongs to. This is useful if the push subscription is inherited in child organizations. E.g. https://your.domain.com/?org={org}

URLs ending with #OBSOLETE-CHARSET will receive updates with a backwards-compatibile iso-8859-2 encoding while all other will receive content encoded with UTF-8.
string GET, POST, PUT
isEnabled Flag which determinates if given subscription is enabled boolean GET, PUT
isValidated Flag which determinates if given subscription is validated boolean GET, PUT
event The type of resource which the subscription will listen to for updates. "CustomerProfile" GET
validationToken Token to validate a new subcription or updated subcription (if the URL is updated). string PUT
format Format of content delivered delivered by given subscription. "application/vnd.api+json", "application/json" GET
createdDateTime The date and time when the subscription was created in our system Datetime GET
failingSince The date and time since when the subscription is failing to push items into your system. Datetime GET

Read a list

List all subscriptions for given organization.

Endpoint

GET https://api.crowdmanager.io/v2/{organization-id}/pushservice/subscriptions?eventname={event}

Query Parameters

Name Description Required
eventname Filter on the event type. False

Example

Request

GET https://api.crowdmanager.io/v2/1201/pushservice/subscriptions?eventname=CustomerProfile
Authorization: Basic aaabbbccc111222333
Accept: application/vnd.api+json

Response

{  
   "subscriptions":[  
      {  
         "id":"1",
         "href":"https://api.crowdmanager.io/v2/1201/pushservice/subscriptions/1",
         "type":"subscriptions",
         "url":"http://requestb.in/1",
         "isEnabled":false,
         "isValidated":false,
         "event":"CustomerProfile"
      },
      {  
         "id":"2",
         "href":"https://api.crowdmanager.io/v2/1201/pushservice/subscriptions/2",
         "type":"subscriptions",
         "url":"http://requestb.in/2",
         "isEnabled":false,
         "isValidated":false,
         "event":"CustomerProfile"
      }]
}

Read

Returns a single subscription for given id.

Endpoint

GET https://api.crowdmanager.io/v2/{organization-id}/pushservice/subscriptions/{subscription-id}

Example

Request

GET https://api.crowdmanager.io/v2/1201/pushservice/subscriptions/2
Authorization: Basic aaabbbccc111222333
Accept: application/vnd.api+json

Response

{
    "subscriptions": {  
         "id":"1",
         "href":"https://api.crowdmanager.io/v2/1201/pushservice/subscriptions/2",
         "type":"subscriptions",
         "url":"http://requestb.in/2",
         "isEnabled":false,
         "isValidated":false,
         "event":"CustomerProfile"
      }
}

Create

Creates a new subscription.

Endpoint

POST https://api.crowdmanager.io/v2/{organization-id}/pushservice/subscriptions

Example

Request

GET https://api.crowdmanager.io/v2/1201/pushservice/subscriptions
Authorization: Basic aaabbbccc111222333
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
{
    "subscriptions": {
        "event": "CustomerProfile",
        "url": "http://my.domain.com/updates"
    }
}

Response

{  
   "subscriptions":{  
      "id":"56",
      "href":"https://api.crowdmanager.io/v2/1201/pushservice/subscriptions/3",
      "type":"subscriptions",
      "url":"http://requestb.in/3",
      "isEnabled":false,
      "isValidated":false,
      "event":"CustomerProfile"
   }
}

Update

Updates the given subscription. Typically used for:

IMPORTANT : When you change the URL of a subscription you will need to validate the subscription again by updating the subscription with the new validation token that will be sent to the new URL that was defined for your subscription. In case, new URL won't return us a successful status code (200) upon calling, - changes to subscription won't be applied.

Endpoint

PUT https://api.crowdmanager.io/v2/{organization-id}/pushservice/subscriptions/{subscription-id}

Example

Validate and enable given subscription.

Request

PUT https://api.crowdmanager.io/v2/1201/pushservice/subscriptions/1
Authorization: Basic aaabbbccc111222333
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
{
    subscriptions: {
        "validationToken": "f1807e04-a99a-402d-8675-3254e8c3bb0a",
        "isEnabled": true
    }
}

Response

{
    "subscriptions": {
        "id": "1",
        "href": "http://api.crowdmanager.io/v2/1201/pushservice/subscriptions/1",
        "type": "subscriptions",
        "url": "http://requestb.in/1",
        "isEnabled": true,
        "isValidated": false,
        "event": "CustomerProfile"
    }
}

Delete

Deletes the given subscription

Endpoint

DELETE https://api.crowdmanager.io/v2/{organization-id}/pushservice/subscriptions/{subscription-id}

Example

Request

DELETE https://api.crowdmanager.io/v2/1201/pushservice/subscriptions/100
Authorization: Basic aaabbbccc111222333

Response

204 No Content