Skip to content

Commit

Permalink
docs(api.md): add event action api documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
navish committed Dec 4, 2019
1 parent 2ea9718 commit 2101ecc
Showing 1 changed file with 356 additions and 1 deletion.
357 changes: 356 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2474,7 +2474,362 @@ HTTP/1.1 200 Success

## EventAction

> TODO
`EventAction` groups emergency response actitvities

### EventAction Schema

`EventAction` have the following attributes:

<br />

| Name | Type | Description |
| :----------: | :----: | :------------------------------------------------------------------------------------------------------------: |
| \_id | String | Unique universal identifier of this event action. |
| name | Object | Human-translatable-readable name for the event action. |
| type | String | Human readable type of a event that the action can be triggered to take place. |
| abbreviation | Object | Human-translatable-readable abbreviation for the name of the event action. |
| description | Object | Human-translatable-readable description for the event action. |
| code | String | Unique human-readable given code of this event action. |
| color | String | A color code(in hexadecimal format) used to differentiate event actions visually. |
| function | String | Human-translatable-readable name of event function to which the action is categorized into. |
| createdAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was created. |
| updatedAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was updated. |

### Create EventAction

To create a new event action, send a `POST` request to `https://api.ewea.io/v1/predefines/eventactions`. The following attributes are supported:

<br/>

| Name | Type | Description | Required |
| :---------: | :----: | :-----------------------------------------------------------------------------------------: | :------: |
| code | String | Unique human-readable given code of this event action. | false |
| type | String | Human readable type of a event that the action can be triggered to take place. | true |
| name | Object | Human-translatable-readable name for the event action. | true |
| description | Object | Human-translatable-readable description for the event action. | false |
| color | String | A color code(in hexadecimal format) used to differentiate event action visually. | false |
| function | String | Human-translatable-readable name of event function to which the action is categorized into. | true |

> Example Request
```curl
curl --request POST \
--url https://api.ewea.io/v1/predefines/eventactions \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <apiKey>' \
--data '{
"name": { "en": "Working with the Regional Disaster Management Committee to
request national assistance from Prime Minister’s Office when required" },
"function": "Direction and Control"
}'
```

The response will be a `JSON object` with the standard event group attributes:

<br/>

| Name | Type | Description |
| :----------: | :----: | :------------------------------------------------------------------------------------------------------------: |
| \_id | String | Unique universal identifier of this event action. |
| name | Object | Human-translatable-readable name for the event action. |
| type | String | Human readable type of a event that the action can be triggered to take place. |
| abbreviation | Object | Human-translatable-readable abbreviation for the name of the event action. |
| description | Object | Human-translatable-readable description for the event action. |
| code | String | Unique human-readable given code of this event action. |
| color | String | A color code(in hexadecimal format) used to differentiate event actions visually. |
| function | String | Human-translatable-readable name of event function to which the action is categorized into |
| createdAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was created. |
| updatedAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was updated. |

> Example Response
```curl
HTTP/1.1 201 Success
{
"_id": "5ddbbc871283e3131b2d41f4",
"type": "Flood",
"name": { "en": "Dead Bodies Management" },
"abbreviation": { "en": "DBM" },
"description": { "en": "" },
"code": "DBM",
"color": "#F9C5A7"
"updatedAt": "2019-02-21T13:45:04.340Z",
"createdAt": "2019-02-21T13:45:04.340Z"
}
```

### Retrieve EventAction

To get a event frunction, send a `GET` request to `https://api.ewea.io/v1/predefines/eventactions/:id`.

> Example Request
```curl
curl --request GET \
--url https://api.ewea.io/v1/predefines/eventactions/5de7b7bb9a6ed7342b200f02 \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <apiKey>'
```

The response will be a `JSON object` with the standard event action attributes:

<br/>

| Name | Type | Description |
| :----------: | :----: | :------------------------------------------------------------------------------------------------------------: |
| \_id | String | Unique universal identifier of this event action. |
| name | Object | Human-translatable-readable name for the event action. |
| type | String | Human readable type of a event that the action can be triggered to take place. |
| abbreviation | Object | Human-translatable-readable abbreviation for the name of the event action. |
| description | Object | Human-translatable-readable description for the event action. |
| code | String | Unique human-readable given code of this event action. |
| color | String | A color code(in hexadecimal format) used to differentiate event actions visually. |
| function | String | Human-translatable-readable name of event function to which the action is categorized into |
| createdAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was created. |
| updatedAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was updated. |

> Example Response
```curl
HTTP/1.1 200 Success
[{
"_id": "5de7b7bb9a6ed7342b200f02",
"name": { "en": "Working with the Regional Disaster Management Committee to
request national assistance from Prime Minister’s Office when required" },
"abbreviation": { "en": "WWTRDMCTRNAFPMOWR" },
"description": {
"en": "Working with the Regional Disaster Management Committee to request
national assistance from Prime Minister’s Office when required" },
"code": "WWTRDMCTRNAFPMOWR",
"color": "#F4EF8D",
"function": {
"name": { "en": "Direction and Control" },
"abbreviation": { "en": "DAC" },
"description": { "en": "Directing and controlling of all emergency response
activities in Dar es Salaam Region, including making sure that the response
is governed by the applicable legal framework, and efforts and resources
are well coordinated and implemented." },
"code": "DAC",
"color": "#9FF9DE",
"_id": "5ddbbc871283e3131b2d41dc",
"updatedAt": "2019-12-04T13:42:43.135Z",
"createdAt": "2019-11-25T11:35:35.518Z"
},
"updatedAt": "2019-12-04T13:42:46.937Z",
"createdAt": "2019-12-04T13:42:20.186Z"
}]
```

### Update EventAction

To update existing event action, send a `PATCH` request to `https://api.ewea.io/v1/predefines/eventactions/:id`. The following attributes are supported:

<br/>

| Name | Type | Description | Required |
| :---------: | :----: | :-----------------------------------------------------------------------------------------: | :------: |
| type | String | Human readable type of a event that the action can be triggered to take place. | true |
| name | Object | Human-translatable-readable name for the event action. | true |
| description | Object | Human-translatable-readable description for the event action. | false |
| function | String | Human-translatable-readable name of event function to which the action is categorized into. | true |

> Example Request
```curl
curl --request PATCH \
--url https://api.ewea.io/v1/predefines/eventactions/5de7b7bb9a6ed7342b200f02 \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <apiKey>' \
--data '{
"name": { "en": "Working with the Regional Disaster Management Committee to
request national assistance from Prime Minister’s Office when required" },
"function": { "en": "Direction and Control" }
}'
```

The response will be a `JSON object` with the standard event action attributes:

<br/>

| Name | Type | Description |
| :----------: | :----: | :------------------------------------------------------------------------------------------------------------: |
| \_id | String | Unique universal identifier of this event action. |
| name | Object | Human-translatable-readable name for the event action. |
| type | String | Human readable type of a event that the action can be triggered to take place. |
| abbreviation | Object | Human-translatable-readable abbreviation for the name of the event action. |
| description | Object | Human-translatable-readable description for the event action. |
| code | String | Unique human-readable given code of this event action. |
| color | String | A color code(in hexadecimal format) used to differentiate event actions visually. |
| function | String | Human-translatable-readable name of event function to which the action is categorized into |
| createdAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was created. |
| updatedAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was updated. |

> Example Response
```curl
HTTP/1.1 200 Success
[{
"_id": "5de7b7bb9a6ed7342b200f02",
"name": { "en": "Working with the Regional Disaster Management Committee to
request national assistance from Prime Minister’s Office when required" },
"abbreviation": { "en": "WWTRDMCTRNAFPMOWR" },
"description": {
"en": "Working with the Regional Disaster Management Committee to request
national assistance from Prime Minister’s Office when required" },
"code": "WWTRDMCTRNAFPMOWR",
"color": "#F4EF8D",
"function": {
"name": { "en": "Direction and Control" },
"abbreviation": { "en": "DAC" },
"description": { "en": "Directing and controlling of all emergency response
activities in Dar es Salaam Region, including making sure that the response
is governed by the applicable legal framework, and efforts and resources
are well coordinated and implemented." },
"code": "DAC",
"color": "#9FF9DE",
"_id": "5ddbbc871283e3131b2d41dc",
"updatedAt": "2019-12-04T13:42:43.135Z",
"createdAt": "2019-11-25T11:35:35.518Z"
},
"updatedAt": "2019-12-04T13:42:46.937Z",
"createdAt": "2019-12-04T13:42:20.186Z"
}]
```

### Delete EventAction

To delete existing event group, send a `DELETE` request to `https://api.ewea.io/v1/predefines/eventactions/:id`.

> Example Request
```curl
curl --request DELETE \
--url https://api.ewea.io/v1/predefines/eventactions/5de7b7bb9a6ed7342b200f02 \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <apiKey>'
```

The response will be a `JSON object` with the standard event action attributes:

<br/>

| Name | Type | Description |
| :----------: | :----: | :------------------------------------------------------------------------------------------------------------: |
| \_id | String | Unique universal identifier of this event action. |
| name | Object | Human-translatable-readable name for the event action. |
| type | String | Human readable type of a event that the action can be triggered to take place. |
| abbreviation | Object | Human-translatable-readable abbreviation for the name of the event action. |
| description | Object | Human-translatable-readable description for the event action. |
| code | String | Unique human-readable given code of this event action. |
| color | String | A color code(in hexadecimal format) used to differentiate event actions visually. |
| function | String | Human-translatable-readable name of event function to which the action is categorized into |
| createdAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was created. |
| updatedAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was updated. |

> Example Response
```curl
HTTP/1.1 200 Success
[{
"_id": "5de7b7bb9a6ed7342b200f02",
"name": { "en": "Working with the Regional Disaster Management Committee to
request national assistance from Prime Minister’s Office when required" },
"abbreviation": { "en": "WWTRDMCTRNAFPMOWR" },
"description": {
"en": "Working with the Regional Disaster Management Committee to request
national assistance from Prime Minister’s Office when required" },
"code": "WWTRDMCTRNAFPMOWR",
"color": "#F4EF8D",
"function": {
"name": { "en": "Direction and Control" },
"abbreviation": { "en": "DAC" },
"description": { "en": "Directing and controlling of all emergency response
activities in Dar es Salaam Region, including making sure that the response
is governed by the applicable legal framework, and efforts and resources
are well coordinated and implemented." },
"code": "DAC",
"color": "#9FF9DE",
"_id": "5ddbbc871283e3131b2d41dc",
"updatedAt": "2019-12-04T13:42:43.135Z",
"createdAt": "2019-11-25T11:35:35.518Z"
},
"updatedAt": "2019-12-04T13:42:46.937Z",
"createdAt": "2019-12-04T13:42:20.186Z"
}]
```

### List All EventAction

To list all event actions, send a `GET` request to `https://api.ewea.io/v1/predefines/`.

> Example Request
```curl
curl --request GET \
--url https://api.ewea.io/v1/predefines/eventactions \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <apiKey>'
```

The response will be a `JSON object` with a `data key`. The values in the `data key` are set of eventaction with the standard event action attributes:

<br/>

| Name | Type | Description |
| :----------: | :----: | :------------------------------------------------------------------------------------------------------------: |
| \_id | String | Unique universal identifier of this event action. |
| name | Object | Human-translatable-readable name for the event action. |
| type | String | Human readable type of a event that the action can be triggered to take place. |
| abbreviation | Object | Human-translatable-readable abbreviation for the name of the event action. |
| description | Object | Human-translatable-readable description for the event action. |
| code | String | Unique human-readable given code of this event action. |
| color | String | A color code(in hexadecimal format) used to differentiate event actions visually. |
| function | String | Human-translatable-readable name of event function to which the action is categorized into |
| createdAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was created. |
| updatedAt | String | A time value given in ISO8601 combined date and time format that represents when the event action was updated. |

> Example Response:
```curl
HTTP/1.1 200 Success
{
"data": [{
"_id": "5de7b7bb9a6ed7342b200f02",
"name": { "en": "Working with the Regional Disaster Management Committee to
request national assistance from Prime Minister’s Office when required" },
"abbreviation": { "en": "WWTRDMCTRNAFPMOWR" },
"description": {
"en": "Working with the Regional Disaster Management Committee to request
national assistance from Prime Minister’s Office when required" },
"code": "WWTRDMCTRNAFPMOWR",
"color": "#F4EF8D",
"function": {
"name": { "en": "Direction and Control" },
"abbreviation": { "en": "DAC" },
"description": { "en": "Directing and controlling of all emergency response
activities in Dar es Salaam Region, including making sure that the response
is governed by the applicable legal framework, and efforts and resources
are well coordinated and implemented." },
"code": "DAC",
"color": "#9FF9DE",
"_id": "5ddbbc871283e3131b2d41dc",
"updatedAt": "2019-12-04T13:42:43.135Z",
"createdAt": "2019-11-25T11:35:35.518Z"
},
"updatedAt": "2019-12-04T13:42:46.937Z",
"createdAt": "2019-12-04T13:42:20.186Z"
}],
"total": 26,
"size": 10,
"limit": 10,
"skip": 0,
"page": 1,
"pages": 3,
"lastModified": "2019-11-25T12:48:43.342Z"
}
```

## EventCatalogue

Expand Down

0 comments on commit 2101ecc

Please sign in to comment.