Update Entire Event

This endpoint updates all fields of the Event specified in the body.

📘

Updating a Single Field

To update only a single field of an Event, please use the PATCH method with the parameters that need to be changed.

Request

To update all attributes of an Event please make a PUT request to the following URL:

HTTP MethodURL
PUThttps://industrial.api.ubidots.com/api/v2.0/events/<event_key>/

Path Parameters

ParameterTypeDescription
event_keyStringThe id or label of the Event, label should use the prefix ~

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter.

Body Parameters

ParameterTypeRequired?Default ValueDescription
labelStringYesN/A (required)The API label of Event
nameStringNoSame as labelName of the Event
descriptionStringNo""Description of Event
tagsString ArrayNo[]Tags of Event
organization<organization_key>NonullKey of Organization (Id or Label)
triggersArray of Object ArrayYesN/A (required)Triggers of Event
actionsObject ArrayYesN/A (required)Actions of Event
isActiveBooleanNoTrueIs True when Event is active
activeDatesObjectYesN/A (required)Active Dates of Event
isGlobalEventBooleanNoFalseTrue if Event is a global Event

Header

ParameterRequiredDescription
X-Auth-TokenYesAuthentication Token of account
$ curl -X PUT 'https://industrial.api.ubidots.com/api/v2.0/events/<event_key>' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '{
    "label": "if-var0-then-telegram",
    "name": "If var0 then Telegram",
    "description": "",
    "tags": [],
    "organization": null,
    "isActive": true,
    "triggers": [
        [
            {
                "type": "last_value",
                "condition": {
                    "value": "60",
                    "operator": ">",
                    "delay": 0
                },
                "entity": {
                    "type": "variable",
                    "value": [
                        {
                            "id": "567890ff1d8472686e9abb4f"
                        }
                    ],
                    "operator": "or"
                }
            }
        ]
    ],
    "actions": [
        {
            "data": {
                "message": "Hey there, {{variable.name}} was {{last_value}} at {{trigger_timestamp|timestampformat('America/Bogota')}}.\n{{from_email}}",
                "numbers": [
                    {
                        "number": "+57  (300) 808 - 3219",
                        "country": {
                            "id": "CO",
                            "label": "Colombia",
                            "value": "+57"
                        }
                    }
                ]
            },
            "name": "Send Telegram",
            "type": "telegram",
            "isGeneric": true,
            "exclusiveFor": [],
            "repeatAction": false,
            "idGroupAction": "6kfdkaaaa",
            "back_to_normal": false,
            "maxRepetitions": 10,
            "repeatInterval": {
                "unit": "T",
                "value": 60
            }
        }
    ],
    "activeDates": {
        "dates": [
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ]
        ],
        "timezone": "America/Bogota"
    },
    "isGlobalEvent": false,
    "isStatusWidgetEvent": false,
    "statusWidgetContext": {}
}'
{
    "url": "https://industrial.api.ubidots.com/api/v2.0/events/123454201d84727dc57df531",
    "id": "123454201d84727dc57df531",
    "label": "if-var0-then-telegram",
    "name": "If var0 then Telegram",
    "description": "",
    "tags": [],
    "organization": null,
    "isActive": true,
    "lastTriggered": 1590043969239,
    "createdAt": "2020-04-21T06:35:12.368604Z",
    "triggers": [
        [
            {
                "type": "last_value",
                "condition": {
                    "value": "60",
                    "operator": ">",
                    "delay": 0
                },
                "entity": {
                    "type": "variable",
                    "value": [
                        {
                            "id": "567890ff1d8472686e9abb4f"
                        }
                    ],
                    "operator": "or"
                }
            }
        ]
    ],
    "actions": [
        {
            "data": {
                "message": "Hey there, {{variable.name}} was {{last_value}} at {{trigger_timestamp|timestampformat('America/Bogota')}}.\n{{from_email}}",
                "numbers": [
                    {
                        "number": "+57  (300) 808 - 3219",
                        "country": {
                            "id": "CO",
                            "label": "Colombia",
                            "value": "+57"
                        }
                    }
                ]
            },
            "name": "Send Telegram",
            "type": "telegram",
            "isGeneric": true,
            "exclusiveFor": [],
            "repeatAction": false,
            "idGroupAction": "6kfdkaaaa",
            "back_to_normal": false,
            "maxRepetitions": 10,
            "repeatInterval": {
                "unit": "T",
                "value": 60
            }
        }
    ],
    "activeDates": {
        "dates": [
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ],
            [
                [
                    "00:00",
                    "23:59"
                ]
            ]
        ],
        "timezone": "America/Bogota"
    },
    "isGlobalEvent": false,
    "isStatusWidgetEvent": false,
    "statusWidgetContext": {}
}
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        ....
    }
}
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}

Response

Returns an Event object of the updated Event.