Skip to main content

Automation Service

The automation resource contains all the automations that you have configured

Automation REST API​

The Automation REST API is a full CRUD API allowing you to search and filter automations as well as update and delete them. It is accessed through the following URL:

https://api.opendatadsl.com/api/automation

The API consists of the following calls:

MethodPathExampleDescription
GETGet the build information for this service
GET{release}v1List all automations
GET{release}/{id}v1/68527adfe438ee467f057624Get a specific automation using its _id
POST{release}v1Create or update an automation, the automation is the body of the POST request
DELETE{release}/{key}v1/idDelete an automation

Notes​

Automation ids and log ids are ObjectID types.

Special REST Calls​

Test an automation​

To test an automation, use the GET an automation with a _run=true query parameter:

Entities​

Automation Entity​

The automation entity contains the following information:

NameDescriptionType
_idUnique id for the automation (an object id)ObjectId
_typeThe type of the automation - always VarAutomationString
activeIf true, this automation is liveBoolean
ownerReadOnly: The person who created/updated the automation (uses their security policies)String
conditionsAn array of objects with the conditions that will fire this automationCondition[]
targetThe automation target to fireString
iconThe icon (bootstrap icons) to be shown next the automation in the GUI - usually the same as the target iconString
templateThe text used to collect information from the userString
nameReadOnly: The name is generated from the template and propertiesString
propertiesThe properties array to send to the targetObject

Condition Entity​

The Condition entity is used to determine if this automation should fire:

NameDescriptionType
sourceThe source of the data that the condition relates toString
serviceThe name of the service the condition relates toString
idThe id of the dataString
actionAn array of actions that determines what triggers this conditionString
keyAn optional custom key to name this data in the target system (_id in the data will be changed to this if it is set)String

Properties Entity​

The properties entity is used to configure an Automation Target:

{
"varname": "value entered by user",
"string": "A string property with no default value",
"group": "group id",
"transformer": "id of a script"
}

Examples​

Example with a transformer​

{
"_id": "{objectid}",
"_type": "VarAutomation",
"target": "odsl.email_attachment",
"active": true,
"template": "When AAA:CURVE is updated, transform the data using [@transformer], then send an email to [to] with subject [subject], add the data as an attachment named [attachmentName].",
"properties": {
"to": "user@company.com",
"subject": "Data is updated",
"attachment": true,
"attachmentName": "data_${date:yyyy-MM-dd}.csv",
"@transformer": "#VarCurve_CSV"
},
"conditions": [{
"source": "private",
"service": "data",
"id": "AAA:CURVE",
"action": "update"
}]
}

Example with a property name change​

{
"_id": "6855145134ff6a7e14c20c10",
"_type": "VarAutomation",
"active": true,
"target": "odsl.email_attachment",
"icon": "envelope-paper",
"template": "When property [@propertyName] on AAA changes to [@propertyValue], send an email to [to] with subject [subject], add the data as an attachment named [attachmentName].",
"properties": {
"to": "user@company.com",
"subject": "Property Change Test",
"attachment": true,
"attachmentName": "AAA.json",
"@propertyName": "isAutomated",
"@propertyValue": "true"
},
"conditions": [{
"source": "private",
"service": "object",
"id": "AAA",
"action": "update"
}]
}