-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#12 Add docs for task create, update and list
- Loading branch information
Showing
3 changed files
with
258 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": "[email protected]", | ||
"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": "[email protected]", | ||
"createdAt": 1630684502715, | ||
"_type": "case_task", | ||
"title": "Malware analysis", | ||
"group": "identification", | ||
"description": "Analysis of the file to identify the malware", | ||
"owner": "[email protected]", | ||
"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" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": "[email protected]", | ||
"createdAt": 1630684502715, | ||
"_type": "case_task", | ||
"title": "Malware analysis", | ||
"group": "identification", | ||
"description": "Analysis of the file to identify the malware", | ||
"owner": "[email protected]", | ||
"status": "InProgress", | ||
"flag": false, | ||
"startDate": 1630683608000, | ||
"endDate": 1630684608000, | ||
"order": 3, | ||
"dueDate": 1630694608000 | ||
}, | ||
{ | ||
"id": "~8360", | ||
"_id": "~8360", | ||
"createdBy": "[email protected]", | ||
"updatedBy": "[email protected]", | ||
"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" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": "[email protected]", | ||
"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": "[email protected]", | ||
"createdAt": 1630684502715, | ||
"updatedBy": "[email protected]", | ||
"updatedAt": 1630685486000, | ||
"_type": "case_task", | ||
"title": "Block malware URLs in proxy", | ||
"group": "containment", | ||
"description": "Add identified malicious URLs in proxy black list", | ||
"owner": "[email protected]", | ||
"status": "Waiting", | ||
"flag": false, | ||
"startDate": 1630683608000, | ||
"endDate": 1630684608000, | ||
"order": 5, | ||
"dueDate": 1630694608000 | ||
} | ||
``` | ||
|
||
=== "401" | ||
|
||
## Response Body Example | ||
```json | ||
{ | ||
"type": "AuthenticationError", | ||
"message": "Authentication failure" | ||
} | ||
``` | ||
|
||
```json | ||
=== "403" | ||
|
||
``` | ||
```json | ||
{ | ||
"type": "AuthorizationError", | ||
"message": "Your are not authorized to update Task, you haven't the permission manageTask" | ||
} | ||
``` |