Create a subscription to define a streaming channel that sends data from devices in the account to an endpoint defined in a target resource.
thingspace_oauth VZ-M2M-Token In: header
M2M Session Token (How to generate an M2M session token?)
In: header
application/json
The request body provides the details of the subscription that you want to create.
TypeScript Definitions
Use the request body type in TypeScript.
The details of the subscription that you want to create.
application/json
curl -X POST "https://example.com/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"}The ID of the authenticating billing account, in the format {"billingaccountid":"1234567890-12345"}.
Descriptive information about the subscription.
Enable or disable the subscription. A disabled subscription will not send any data.
The address to which any error reports should be delivered.
String containing a $filter object with a property and value to filter out non-matching events.
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.
The ID of the target resource to be used when dispatching events. The corresponding target should have a “stream” addressscheme.
Name of the subscription.
Setting this value to false prevents the data returned from being aggregated and makes the data easier to parse.