Description

Use a HTTP POST request to create an action.

Request

HTTP Method: POST

Parameter Description
type Type of action to create:
Agents::EmailAgent
Agents::EventTransformationAgent
Agents::HTTPRequestAgent
Agents::IMAPAgent
Agents::TriggerAgent
Agents::WebhookAgent
Agents::SendToStoryAgent
name Name of the action.
story_id ID of story to which the action should be added.
keep_events_for Event retention period in seconds.
source_ids Array of action IDs the action should receive emitted events from.
receiver_ids Array of action IDs the action should emit events to.
position An object describing the XY coordinates of the action on the story diagram.
options JSON Options block of the action.

Sample request

curl -X POST \
  https://<tenant-name>.tines.io/api/v1/agents/<action-id> \
  -H 'content-type: application/json' \
  -H 'x-user-email: <email-address>' \
  -H 'x-user-token: <api-token>'
  -d '{
        "type":"Agents::EventTransformationAgent",
        "name": "Extract email addresses and urls",
        "story_id":1,
        "keep_events_for":604800,
        "source_ids": [100, 102],
        "receiver_ids":[],
        "position": {"x": 100, "y": 200},
        "options":{
          "mode": "extract",
          "matchers": [
            {
              "path": "{{.text}}",
              "regexp": "\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}\\b",
              "to": "email_addresses"
            },
            {
              "path": "{{.text}}",
              "regexp": "https?:\\/\\/[\\S]+",
              "to": "urls"
            }
          ],
          "message": "This is an optional message"
        }
      }'

Response

A successful request will return a JSON object describing the created action.

Field description

Parameter Description
id Action ID.
user_id User ID of the action’s owner.
options JSON Options block of the action.
name Name of the action.
schedule Defined run schedule for the action.
events_count Number of events action has emitted.
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.
last_checked_event_id Last event_id process by the action.
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_web_request_at ISO 8601 Timestamp representing last web request process by the action.
keep_events_for Defined event retention period in seconds.
last_event_at ISO 8601 Timestamp representing date and time the last event was received.
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.
position An object describing the XY coordinates of the action on the story diagram.
story_id ID of story to which the action belongs.

Sample response

{
  "id": 242,
  "user_id": 1,
  "options": {
    "mode": "extract",
    "matchers": [
      {
        "path": "{{.text}}",
        "regexp": "\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}\\b",
        "to": "email_addresses"
      },
      {
        "path": "{{.text}}",
        "regexp": "https?:\\/\\/[\\S]+",
        "to": "urls"
      }
    ],
    "message": "This is an optional message"
  },
  "name": "Extract email addresses and urls",
  "schedule": null,
  "events_count": 0,
  "last_check_at": null,
  "last_receive_at": null,
  "last_checked_event_id": 92020,
  "created_at": "2018-06-05T14:16:22.008Z",
  "updated_at": "2018-06-05T14:16:22.008Z",
  "last_web_request_at": null,
  "keep_events_for": 604800,
  "last_event_at": null,
  "last_error_log_at": null,
  "disabled": false,
  "guid": "f990f6f3f3ba0ea366532902d4d6ca44",
  "position": { "x": 100, "y": 200 },
  "story_id": 1
}