Cloud Connector Subscriptions

CreateSubscription

POST
/cc/v1/subscriptions

Create a subscription to define a streaming channel that sends data from devices in the account to an endpoint defined in a target resource.

Authorization

thingspace_oauth VZ-M2M-Token
AuthorizationBearer <token>

This is the ThingSpace token, from Credentials and Tokens is used

In: header

VZ-M2M-Token<token>

M2M Session Token (How to generate an M2M session token?)

In: header

Request Body

application/json

The request body provides the details of the subscription that you want to create.

The request body provides the details of the subscription that you want to create.

accountidentifier?

The ID of the authenticating billing account, in the format {"billingaccountid":"1234567890-12345"}.

description?string

Descriptive information about the subscription.

disabled?boolean

Enable or disable the subscription. A disabled subscription will not send any data.

email?string

The address to which any error reports should be delivered.

filter?string

String containing a $filter object with a property and value to filter out non-matching events.

billingaccountid?string
streamkind?string

The type of event data to send via this subscription. This will be ts.event in most cases. Other event types are ts.event.diagnostics for device diagnostic data, ts.event.configuration for device configuration events, or ts.event.security. Note that the device ThingSpace client must support sending specific event types for anything other than ts.event.

targetid?string

The ID of the target resource to be used when dispatching events. The corresponding target should have a “stream” addressscheme.

name?string

Name of the subscription.

allowaggregation?boolean

Setting this value to false prevents the data returned from being aggregated and makes the data easier to parse.

Response Body

application/json

curl -X POST "https://example.com/cc/v1/subscriptions" \  -H "Content-Type: application/json" \  -d '{    "accountidentifier": {      "billingaccountid": "1223334444-00001"    },    "billingaccountid": "1223334444-00001",    "allowaggregation": false,    "name": "Account subscription 1",    "targetid": "{target ID}",    "streamkind": "ts.event",    "email": "me@mycompany.com"  }'
{  "configurationfailures": 0,  "createdon": "2018-12-21T05:05:02.134Z",  "delegateid": "00000000-0000-0000-0000-000000000000",  "id": "d8c145dd-6948-67ec-ed9b-6a298806bb4a",  "kind": "ts.subscription",  "laststreamingstatus": "",  "laststreamingtime": "0001-01-01T00:00:00Z",  "lastupdated": "2018-12-21T05:22:12.178Z",  "networkfailures": 0,  "streamfailures": 0,  "streamkind": "ts.event",  "targetid": "4e211a0e-e39d-6c32-e15b-d6f07f9e2ec8",  "version": "1.0",  "versionid": "5ed6063f-04e0-11e9-8279-02420a5e1b0b"}