Description
Import a new story. Note that if the story data includes embedded substories these will not be imported.
Request
HTTP Method: POST
Query Parameter | Description |
---|---|
new_name | The new name for the story. |
data | JSON object representing the story in exported form |
team_id | Optional ID of team to which the story should be added. |
folder_id | Optional ID of folder to which the story should be added. |
mode | Optional Create a new story or update existing by Name (new , versionReplace ) default: new |
curl -X POST \
https://<<META.tenant.domain>>/api/v1/stories/import \
-H 'content-type: application/json' \
-H 'x-user-token: <<CREDENTIAL.tines_api_key>>'
-d '{
"new_name": "Imported story",
"team_id": 2,
"folder_id": 1,
"data": {
"schema_version": 3,
"name": "Simple story",
"description": "In the simple story we will create a fictional situation where a detection system is configured to send alerts to our Tines tenant",
"guid": "31fca4bedaf10c096027428a6de59317",
"exported_at": "2021-03-23T08:19:24Z",
"agents": [
{
"type": "Agents::TriggerAgent",
"name": "User is ceo",
"disabled": false,
"guid": "0b4edda0e22d7d36e2bb61498bd76f7e",
"options": {
"rules": [
{
"type": "regex",
"value": "ceo",
"path": "{{.explode_users.user.job}}"
}
]
},
"keep_events_for": 0
},
{
"type": "Agents::EmailAgent",
"name": "Notify by email",
"disabled": false,
"guid": "da7d3d8895f1c2656ce493fe08a92d31",
"options": {
"recipients": "tinesdemouser@outlook.com",
"subject": "Engineer in infected",
"body": "Hello,<br/><br/>An alert has been detected that relates to an infected engineer. The users details are shown below:<br/><b>Name:</b> {{.explode_users.user.name}}<br/><b>Age:</b> {{.explode_users.user.age}}<br/><b>Country:</b> {{.explode_users.user.country}}<br/><br/>Thanks!"
},
"schedule": null,
"keep_events_for": 0
},
{
"type": "Agents::WebhookAgent",
"name": "Receive events",
"disabled": false,
"guid": "86958e9f9265a2ee62051f9ca849afe0",
"options": {
"secret": "201367c22bd83f4e79ac81aa9f9efb7c",
"verbs": "post",
"include_headers": "false"
},
"keep_events_for": 0
},
{
"type": "Agents::TriggerAgent",
"name": "Type is infection",
"disabled": false,
"guid": "26e53a744d9902f33157a27851f9698c",
"options": {
"rules": [
{
"type": "regex",
"value": "infection",
"path": "{{ .receive_events.type }}"
}
]
},
"keep_events_for": 0
},
{
"type": "Agents::EventTransformationAgent",
"name": "Explode users",
"disabled": false,
"guid": "0e04d783765b092f50f9f1865a5ec32c",
"options": {
"mode": "explode",
"path": "{{.receive_events.users}}",
"to": "user"
},
"schedule": null,
"keep_events_for": 0
},
{
"type": "Agents::TriggerAgent",
"name": "User is student",
"disabled": false,
"guid": "71e74a31f75a346e85eecaed2e417ec6",
"options": {
"rules": [
{
"type": "regex",
"value": "student",
"path": "{{.explode_users.user.job}}"
}
]
},
"keep_events_for": 0
},
{
"type": "Agents::TriggerAgent",
"name": "User is engineer",
"disabled": false,
"guid": "ad401cd734aa03406ace8a373cbf04f3",
"options": {
"rules": [
{
"type": "regex",
"value": "engineer",
"path": "{{.explode_users.user.job}}"
}
]
},
"keep_events_for": 0
},
{
"type": "Agents::HTTPRequestAgent",
"name": "Send a post request",
"disabled": false,
"guid": "c2a0edfee0cdd70889bc8fc9cc973786",
"options": {
"url": "https://postman-echo.com/post",
"content_type": "json",
"method": "post",
"payload": {
"name": "{{.explode_users.user.name}}",
"age": "{{.explode_users.user.age}}",
"country": "{{.explode_users.user.country}}",
"job": "{{.explode_users.user.job}}"
},
"log_error_on_status": []
},
"schedule": null,
"keep_events_for": 0
}
],
"diagram_notes": [],
"links": [
{
"source": 0,
"receiver": 7
},
{
"source": 2,
"receiver": 3
},
{
"source": 3,
"receiver": 4
},
{
"source": 4,
"receiver": 6
},
{
"source": 4,
"receiver": 5
},
{
"source": 4,
"receiver": 0
},
{
"source": 6,
"receiver": 1
}
],
"diagram_layout": "{\"0b4edda0e22d7d36e2bb61498bd76f7e\":[105.0,-195.0],\"da7d3d8895f1c2656ce493fe08a92d31\":[345.0,-120.0],\"86958e9f9265a2ee62051f9ca849afe0\":[345.0,-435.0],\"26e53a744d9902f33157a27851f9698c\":[345.0,-360.0],\"0e04d783765b092f50f9f1865a5ec32c\":[345.0,-285.0],\"71e74a31f75a346e85eecaed2e417ec6\":[570.0,-195.0],\"ad401cd734aa03406ace8a373cbf04f3\":[345.0,-195.0],\"c2a0edfee0cdd70889bc8fc9cc973786\":[105.0,-120.0]}",
"send_to_story_enabled": false,
"entry_agent_guid": null,
"exit_agent_guids": [],
"exit_agent_guid": null,
"send_to_stories": [],
"form": {
"name": "Simple story Form",
"description": "",
"fields": [],
"visibility": "tenant",
"agent_guid": null,
"success_message": "Thank you for your submission"
}
}
}'
Response
A successful request will return a JSON object describing the newly created story
Field description
Parameter | Description |
---|---|
id | The story ID. |
name | The story name. |
user_id | ID of story owner. |
description | A user-defined description of the story. |
created_at | ISO 8601 Timestamp representing date and time the story was created. |
updated_at | ISO 8601 Timestamp representing date and time the story was last updated. |
keep_events_for | Defined event retention period in seconds. |
disabled | Boolean flag indicating whether story is disabled. |
priority | Boolean flag indicating whether story is hight priority story. |
guid | Unique identifier of the story. |
team_id | ID of team to which the story belongs. |
folder_id | ID of folder to which the story belongs. |
mode | The mode of the story Live or TEST |
Sample response
{
"id": 2,
"name": "Imported story",
"user_id": 1,
"created_at": "2021-03-235T20:06:14.825Z",
"updated_at": "2021-03-23T20:06:14.825Z",
"description": "In the simple story we will create a fictional situation where a detection system is configured to send alerts to our Tines tenant",
"guid": "b7c81e0cb416ae8f4c00874ca7b1cdf8",
"keep_events_for": 604800,
"disabled": false,
"priority": false,
"team_id": 2,
"folder_id": 1,
"mode": "LIVE"
}