From 48cbbe7d6337a8a6b9f0d8a1b11dabfb2a885970 Mon Sep 17 00:00:00 2001 From: To-om Date: Sat, 4 Sep 2021 07:56:55 +0200 Subject: [PATCH] #12 Add docs for task create, update and list --- docs/thehive/api/task/create.md | 88 ++++++++++++++++++++++++++++++ docs/thehive/api/task/list.md | 96 +++++++++++++++++++++++++++++++++ docs/thehive/api/task/update.md | 80 ++++++++++++++++++++++++--- 3 files changed, 258 insertions(+), 6 deletions(-) create mode 100644 docs/thehive/api/task/list.md diff --git a/docs/thehive/api/task/create.md b/docs/thehive/api/task/create.md index e69de29b..5bb3c06a 100644 --- a/docs/thehive/api/task/create.md +++ b/docs/thehive/api/task/create.md @@ -0,0 +1,88 @@ +# Create + +Create a *Task* (requires `manageTask` permission). + +## Query + +```plain +POST /api/case/{id}task +``` + +With: + +- `id`: Case identifier + +## Request Body Example + +!!! Example "" + + ```json + { + "title": "Malware analysis", + "group": "identification", + "description": "Analysis of the file to identify the malware", + "owner": "jerome@strangebee.com", + "status": "InProgress", + "flag": false, + "startDate": 1630683608000, + "endDate": 1630684608000, + "order": 3, + "dueDate": 1630694608000 + } + ``` + +The only required field is `title`. + +The `status` can be `Waiting`, `InProgress`, `Completed` or `Cancel`. + +## Response + +### Status codes + +- `201`: if *Tasks* is created successfully +- `401`: Authentication error +- `403`: Authorization error + +### Response Body Example + +!!! Example "" + + === "201" + + ```json + { + "id": "~4264", + "_id": "~4264", + "createdBy": "jerome@strangebee.com", + "createdAt": 1630684502715, + "_type": "case_task", + "title": "Malware analysis", + "group": "identification", + "description": "Analysis of the file to identify the malware", + "owner": "jerome@strangebee.com", + "status": "InProgress", + "flag": false, + "startDate": 1630683608000, + "endDate": 1630684608000, + "order": 3, + "dueDate": 1630694608000 + } + ``` + + === "401" + + ```json + { + "type": "AuthenticationError", + "message": "Authentication failure" + } + ``` + + === "403" + + ```json + { + "type": "AuthorizationError", + "message": "Your are not authorized to create Task, you haven't the permission manageTask" + } + ``` \ No newline at end of file diff --git a/docs/thehive/api/task/list.md b/docs/thehive/api/task/list.md new file mode 100644 index 00000000..d4a033fb --- /dev/null +++ b/docs/thehive/api/task/list.md @@ -0,0 +1,96 @@ +# List + +List *Task*s of a case. + +## Query + +```plain +POST /api/v0/query +``` + +## Request Body Example + +!!! Example "" + + List 15 waiting tasks in case ~25485360. + + ```json + { + "query": [ + { + "_name": "getCase", + "idOrName": "~25485360" + }, + { + "_name": "tasks" + }, + { + "_name": "filter", + "status": "Waiting" + }, + { + "_name": "page", + "from": 0, + "to": 15 + } + ] + } + ``` + +## Response + +### Status codes + +- `200`: if *Task* is updated successfully +- `401`: Authentication error + +### Response Body Example + +!!! Example "" + + === "201" + + ```json + [ + { + "id": "~4264", + "_id": "~4264", + "createdBy": "jerome@strangebee.com", + "createdAt": 1630684502715, + "_type": "case_task", + "title": "Malware analysis", + "group": "identification", + "description": "Analysis of the file to identify the malware", + "owner": "jerome@strangebee.com", + "status": "InProgress", + "flag": false, + "startDate": 1630683608000, + "endDate": 1630684608000, + "order": 3, + "dueDate": 1630694608000 + }, + { + "id": "~8360", + "_id": "~8360", + "createdBy": "jerome@strangebee.com", + "updatedBy": "jerome@strangebee.com", + "createdAt": 1630687291729, + "updatedAt": 1630687323936, + "_type": "case_task", + "title": "Block malware URLs in proxy", + "group": "containment", + "description": "Add identified malicious URLs in proxy black list", + "status": "Waiting", + "flag": false, + "order": 0 + } + ``` + + === "401" + + ```json + { + "type": "AuthenticationError", + "message": "Authentication failure" + } + ``` diff --git a/docs/thehive/api/task/update.md b/docs/thehive/api/task/update.md index edd17b09..3f960e45 100644 --- a/docs/thehive/api/task/update.md +++ b/docs/thehive/api/task/update.md @@ -1,21 +1,89 @@ # Update +Update a *Task* (requires `manageTask` permission). + ## Query +```plain +PATCH /api/case/task/{id} ``` -``` +with: + +- `id`: id of the task. ## Request Body Example -```json +!!! Example "" -``` + ```json + { + "title": "Block malware URLs in proxy", + "group": "containment", + "description": "Add identified malicious URLs in proxy black list", + "owner": "jerome@strangebee.com", + "status": "Waiting", + "flag": false, + "startDate": 1630683608000, + "endDate": 1630684608000, + "order": 5, + "dueDate": 1630694608000 + } + ``` + +No fields are required. + +## Response + +### Status codes + +- `200`: if *Task* is updated successfully +- `401`: Authentication error +- `403`: Authorization error + +### Response Body Example + +!!! Example "" + + === "201" + ```json + { + "id": "~4264", + "_id": "~4264", + "createdBy": "jerome@strangebee.com", + "createdAt": 1630684502715, + "updatedBy": "jerome@strangebee.com", + "updatedAt": 1630685486000, + "_type": "case_task", + "title": "Block malware URLs in proxy", + "group": "containment", + "description": "Add identified malicious URLs in proxy black list", + "owner": "jerome@strangebee.com", + "status": "Waiting", + "flag": false, + "startDate": 1630683608000, + "endDate": 1630684608000, + "order": 5, + "dueDate": 1630694608000 + } + ``` + + === "401" -## Response Body Example + ```json + { + "type": "AuthenticationError", + "message": "Authentication failure" + } + ``` -```json + === "403" -``` \ No newline at end of file + ```json + { + "type": "AuthorizationError", + "message": "Your are not authorized to update Task, you haven't the permission manageTask" + } + ``` \ No newline at end of file