Skip to content

Commit

Permalink
#12 Add docs for task create, update and list
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Sep 4, 2021
1 parent 8df400d commit 48cbbe7
Show file tree
Hide file tree
Showing 3 changed files with 258 additions and 6 deletions.
88 changes: 88 additions & 0 deletions docs/thehive/api/task/create.md
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"
}
```
96 changes: 96 additions & 0 deletions docs/thehive/api/task/list.md
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"
}
```
80 changes: 74 additions & 6 deletions docs/thehive/api/task/update.md
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"
}
```

0 comments on commit 48cbbe7

Please sign in to comment.