Skip to main content

Subscription Service

The subscription resource is used to manage subscriptions

REST API

The Subscription REST API is a full CRUD API and is accessed through the following URL:

https://api.opendatadsl.com/api/subscription

The API consists of the following calls:

MethodPathExampleDescription
GETGet the build information for this service
GET{release}v1List all your subscriptions
GET{release}/{key}v1/TESTRetrieve a subscriptions using its name
POST{release}v1Create or update a subscription, the subscription configuration is the body of the POST request
DELETE{release}/{key}v1/TESTDelete a subscription

Entities

Subscription configuration

The subscription configuration contains the following information:

NameDescriptionType
nameUnique name for the subscriptionString
enabledA boolean indicating if this subscription is activeBoolean
objectsA list of resources to subscribe toList(Object)
targetsA list of targets to send the subscribed resources toList(Object)

Subscribed items

The objects element of the subscription configuration contains the resources that you want to subscribe to and has the following attributes:

NameDescriptionType
serviceThe name of the service for the resource, e.g. object, data etc.String
idThe id of the resourceString
keyA definable reference that can be used to identify this resourceString
actionA list of actions that will trigger this subscriptionList(String)

Targets

The targets element of the subscription contains the targets that you want to send the data to, each target type has a different configuration.

BlobTarget

A target to send data to an Azure Blob

NameDescriptionType
nameAlways 'BlobTarget'String
storageThe URL for the Azure storageString
containerThe name of the Blob storage containerString
pathOptional path within the storage containerString
adlsA boolean indicating if this is Azure Data Lake StorageBoolean

CurveTarget

A target to build a curve

NameDescriptionType
nameAlways 'CurveTarget'String
curveThe id of the curve to buildString

EmailTarget

A target to send data as an email

NameDescriptionType
nameAlways 'EmailTarget'String
toA comma or space separated list of recipient email addressesString
htmlAn optional mustache template script to convert the data to htmlString
subjectThe subject of the emailString
attachmentA boolean indicating to send the data as an attachment, defaults to trueBoolean

ProcessTarget

A target to trigger the running of a process

NameDescriptionType
nameAlways 'ProcessTarget'String
processThe name of the process to triggerString

PublishTarget

A target to publish data to another tenant

NameDescriptionType
nameAlways 'PublishTarget'String
toThe id of the tenant to publish toString

QueueTarget

A target to send data to a message queue

NameDescriptionType
nameAlways 'QueueTarget'String
queueThe name of the queue to send the data toString
subjectThe optional subject to add to the messageString

ReportTarget

A target to run a report

NameDescriptionType
nameAlways 'ReportTarget'String
reportThe id of the report to runString
rangeThe optional date range to run the report forString

ScriptTarget

A target to run a script

NameDescriptionType
nameAlways 'ScriptTarget'String
scriptThe id of the script to runString

WebhookTarget

A target to send data to a webhook URL

NameDescriptionType
nameAlways 'WebhookTarget'String
urlThe webhook url to send the data toString

Examples

### Get build info
GET {{url}}/subscription
Authorization: Bearer {{token}}

### List all my subscriptions
GET {{url}}/subscription/v1
Authorization: Bearer {{token}}

### List all my subscription names
GET {{url}}/subscription/v1?_distinct=name
Authorization: Bearer {{token}}

### List all my subscriptions of a specific target type
GET {{url}}/subscription/v1?targets.name=PublishTarget
Authorization: Bearer {{token}}

### Get a specific subscription
GET {{url}}/subscription/v1/EEX.NG.AT.CEGH_VTP.H8B.FUT:SC_BST_SETTLE
Authorization: Bearer {{token}}

### Create a subscription
POST {{url}}/subscription/v1
Authorization: Bearer {{token}}

{
"name": "QAExample",
"objects": [{
"key": "PRIMARY",
"id": "NZ_FONTERRA_SALTED_25KG_NZ:CURVE",
"optional": false,
"action": ["create","update"]
}],
"targets":[{
"name": "ProcessTarget",
"process": "SimpleScript"
}]
}

### Delete a subscription
DELETE {{url}}/subscription/v1/QAExample
Authorization: Bearer {{token}}