To create multiple Events, make a POST request to the following URL:
HTTP Method URL POST https://industrial.api.ubidots.com/api/v2.0/events/_/bulk/create
Parameter Type Use Description token String Authentication The authentication token can optionally be sent as a query parameter.
Parameter Type Required? Default Value Description label String Yes N/A (required) API label of Event name String No Same as label Name of Event description String No ""Description of Event tags String Array No []Tags of Event organization <organization_key> No nullKey of Organization (Id or Label) triggers Array of Object Array Yes N/A (required) Triggers of Event actions Object Array Yes N/A (required) Actions of Event isActive Boolean No TrueIs True when Event is active activeDates Object Yes N/A (required) All Active Dates of Event isGlobalEvent Boolean No FalseTrue if Event is a global event
Parameter Type Description X-Auth-Token String Authentication Token of accountX-Bulk-Operation Boolean Must be set to true for the bulk operation to work Content-Type String (application/json) Content type of the request body
cURL (Request)
curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/events/_/bulk/create/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '[
{
"label": "Event 1",
"triggers": [
[
{
"type": "last_value",
"condition": {
"type": "value",
"value": "0",
"operator": "==",
"delay": 0.0
},
"entity": {
"type": "variable",
"value": [
{
"id": "6492276d7ca5cf4fc79cba26"
}
],
"operator": "or"
}
}
]
],
},
...
{
"label": "Event 4",
"actions": [
{
"type": "email",
"name": "Send Email",
"data": {
"emails": [
"[email protected] "
],
"message": "Hey there, {{variable.name}} was {{last_value}} at {{trigger_timestamp|timestampformat('America/Bogota')}}.",
"subject": "{{variable.name}} alert!"
},
"back_to_normal": false,
"idGroupAction": "0pdrfbm4a"
}
],
},
]'
202 Accepted 400 Bad Request 401 Unauthorized 403 Forbidden
{
"task": {
"id": "tyg54645501a9ca5714e7b098721"
}
}{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}{
"detail": "Header `X-BULK-OPERATION` should be provided for bulk operation."
}
Returns an Event object of the Bulk Event created.