For the examples we will use the next JSON as headers
var headers = {
'Fiware-Correlator': '3451e5c2-226d-11e6-aaf0-d48564c29d20'
}
But you can use another options,one empty JSON or you can ignore the headers if you don't need them
Example
cb.listSubscriptions(headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
Example
cb.getSubscription("5a83c5463fc4dec59e4ef8e2", headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
Example
cb.createSubscription({
"description": "Alert subscription TEST",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Alert"
}
],
"condition": {
"attrs": [
"id",
"type",
"category",
"subCategory",
"location",
"address",
"dateObserved",
"validFrom",
"validTo",
"description",
"alertSource",
"data",
"severity"
]
}
},
"notification": {
"attrs": [
"id",
"type",
"category",
"subCategory",
"location",
"address",
"dateObserved",
"validFrom",
"validTo",
"description",
"alertSource",
"data",
"severity"
],
"attrsFormat": "normalized",
"http": {
"url": "http://service.mx"
}
},
"throttling": 5
}, headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
Example
cb.updateSubscription("5a93a9063fc4dec59e4ef8eb", {
"description": "Alert subscription TEST",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Alert"
}
],
"condition": {
"attrs": [
"id",
"type",
"location",
"address",
"dateObserved",
"validFrom",
"validTo",
"description",
]
}
},
"notification": {
"attrs": [
"id",
"type",
"category",
"subCategory",
"location",
"address",
"dateObserved",
"validFrom",
"validTo",
"description",
"alertSource",
"data",
"severity"
],
"attrsFormat": "normalized",
"http": {
"url": "http://crateservice.com"
}
},
"throttling": 5
}, headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
Example
cb.updateSubscriptionStatus("5a81e50a3fc4dec59e4ef8dc", "active", headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
##Delete Subscription.
Example
cb.deleteSubscription("5a93a9103fc4dec59e4ef8ec", headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))