Actions: Update
Description
Update an action.
Request
HTTP Method: PUT
| Parameter | Description |
|---|---|
| action_id | ID of the action |
| name | Optional Name of the action. |
| description | Optional A user-defined description of the action. |
| options | Optional JSON Options block of the action. |
| position | Optional An object describing the XY coordinates of the action on the story diagram. |
| source_ids | Optional Array of action IDs the action should receive emitted events from. |
| links_to_sources | Optional Array of objects representing links to source actions. Mutually exclusive with source_ids field. Each object has source_id (required) and type (optional; "DEFAULT", "NO_MATCH", or "FAILURE") |
| receiver_ids | Optional Array of action IDs the action should emit events to. |
| links_to_receivers | Optional Array of objects representing links to receiver actions. Mutually exclusive with receiver_ids field. Each object has receiver_id (required) and type (optional; "DEFAULT", "NO_MATCH", or "FAILURE") |
| schedule | Optional An object defining the cron schedule for the action. |
| disabled | Optional Boolean flag indicating whether action is disabled. |
| monitor_failures | Optional Boolean flag indicating if a notification should be sent when this action fails. NOTE You must include the monitor_all_events parameter if updating this value |
| monitor_all_events | Optional Boolean flag indicating if all events should be monitored. NOTE You must include the monitor_failures parameter if updating this value |
| monitor_no_events_emitted | Optional Duration in seconds. If no events are emitted in this time, a notification will be sent. NOTE You must include both the monitor_failures and monitor_all_event parameters if updating this value |
| num_runs_to_save | Optional Number of story runs to save for this action. Only present for Receive Email and Webhook agents. About story runs |
Credentials in options
When plaintext credential blocking is on for your tenant, options can't contain a credential's value, because it would be stored in plain text. A request that adds the value of a credential the action's team can access to options fails with a 422 error (see Errors). Reference the credential instead, so its value is only resolved when the action runs:
- From a script or another client outside Tines, send the reference as-is:
<<CREDENTIAL.my_token>>. - From a Tines HTTP Request action, escape the reference, because the action resolves references before it sends the request:
\<<CREDENTIAL.my_token>>in text, or"<<CREDENTIAL.my_token>>"in a formula. An HTTP Request action that calls its own tenant's actions API with a credential's value in the URL, query parameters, or payload fails before sending, with an error in its logs. Headers aren't checked, so an API key in theAuthorizationheader still works.
An action whose options already hold a credential's value can still be updated, as long as the request doesn't add one. Values shorter than 12 characters, and values that are only a hostname, a bare HTTP(S) origin such as https://example.com, or an email address, aren't checked.
Sample request
curl -X PUT \
https://<tenant-domain>/api/v1/actions/<<action_id>> \
-H 'content-type: application/json' \
-H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
-d '{
"name": "New action name"
}'
Add links with types
curl -v -X PUT \
"https://<tenant-domain>/api/v1/actions/<<source_action_id>>" \
-H 'content-type: application/json' \
-H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
-d '{
"links_to_receivers": [
{
"receiver_id": "<<receiver_action_id>>",
"type": "NO_MATCH"
}
]
}'
Response
A successful request will return a JSON object describing the updated action.
Field description
| Parameter | Description |
|---|---|
| id | Action ID. |
| type | Action type |
| user_id | User ID of the action's owner. |
| options | JSON Options block of the action. |
| name | Name of the action. |
| description | A user-defined description of the action. |
| schedule | An object defining the cron schedule for the action. |
| blended_events_count | Number of events action has emitted in both TEST and LIVE mode. |
| logs_count | Number of logs action has stored. |
| last_check_at | ISO 8601 Timestamp representing date and time of action's last scheduled run. |
| last_receive_at | ISO 8601 Timestamp representing date and time of last event received. |
| created_at | ISO 8601 Timestamp representing creation date and time of action. |
| updated_at | ISO 8601 Timestamp representing last updated date and time of action. |
| last_event_at | ISO 8601 Timestamp representing date and time the last event was received. Updated at one-minute intervals. |
| last_error_log_at | ISO 8601 Timestamp representing date and time of last error thrown by the action. |
| disabled | Boolean flag indicating whether action is disabled. |
| guid | Unique identifier of the action. |
| group_id | ID of group to which the action belongs. |
| position | An object describing the XY coordinates of the action on the story diagram. |
| story_id | ID of story to which the action belongs. |
| story_mode | Mode of the story to which the action belongs LIVE or TEST |
| nested_group_id | ID of group contained in the action. |
| team_id | ID of team to which the action belongs. |
| sources | An Array of Action IDs this action receives emitted events from. |
| receivers | An Array of Action IDs this action emits events to. |
| monitor_failures | Boolean flag indicating if a notification should be sent when this action fails. |
| monitor_all_events | Boolean flag indicating if all events should be monitored. |
| monitor_no_events_emitted | Duration in seconds. If no events are emitted in this time, a notification will be sent. |
| time_saved_unit | Unit of time corresponding to time saved value. |
| time_saved_value | Number indicating the amount of time saved. |
| page | An object with information on the associated page, if this is a page action |
| action_memory_contents | An object containing an array of the values an action may be holding in its memory. |
| slug | An underscored representation of the action's name |
| links_to_sources | An array of links to source actions, including the source ID and the link type |
| links_to_receivers | An array of links to receiver actions, including the receiver ID and the link type |
| story_run_save_setting | An object containing the story run save settings for this action. Only present for Receive Email and Webhook agents. About story runs |
Sample response
{
"id": 73563,
"user_id": 167,
"type": "Agents::EventTransformationAgent",
"options": {
"mode": "deduplicate",
"path": "{{.propagation_webhook.password}}",
"lookback": "1"
},
"name": "New action name",
"description": null,
"schedule": [
{
"cron": "*/1 * * * *",
"timezone": "Europe/Dublin"
}
],
"blended_events_count": 2,
"logs_count": 4,
"last_check_at": "2021-05-07T11:46:50Z",
"last_receive_at": "2021-05-07T11:46:50Z",
"created_at": "2021-05-07T11:42:58Z",
"updated_at": "2021-05-07T11:47:00Z",
"last_event_at": "2021-05-07T11:47:00Z",
"last_error_log_at": null,
"disabled": false,
"guid": "f3fe6f8e167c9db42e64eaef8e5d2f0c",
"group_id": null,
"position": {
"x": -945,
"y": 450
},
"receivers": [70118],
"sources": [70116],
"story_id": 807,
"story_mode": "LIVE",
"team_id": 335,
"monitor_failures": true,
"monitor_all_events": true,
"monitor_no_events_emitted": 86400,
"time_saved_unit": "minutes",
"time_saved_value": 10,
"page": null,
"story_id": 807,
"story_mode": "LIVE",
"nested_group_id": null,
"links_to_sources": [
{
"source_id": 70116,
"link_type": "DEFAULT"
}
],
"links_to_receivers": [
{
"receiver_id": 70118,
"link_type": "NO_MATCH"
}
]
}
Errors
| Status | Meaning |
|---|---|
| 422 | Blocking is on for your tenant and the request adds a credential's value to options (see Credentials in options). The response body is a JSON array holding the error message. |
[
"This action's options contain the value of the my_token credential, which would be saved as plain text. Reference it with <<CREDENTIAL.my_token>> instead. If another action sets these options through the API, have it send \\<<CREDENTIAL.my_token>> as text, or \"<<CREDENTIAL.my_token>>\" in a formula, so the reference isn't resolved before it's sent."
]