Incident Management Report - OHV
Overview
- Incident management API is based on Restful service, working through HTTP Protocol.
- The API provides specific methods for OHV with Incident Report module on GRID and other systems
Endpoint
- Base API Url: {Server URL}/v2/integration
Tools
- For testing we can use free and popular tools like: Postman
- Download at: https://www.postman.com/downloads/
Authentication
- The API requires authentication with HTTP Basic Auth Type
- You can use the account as below for testing
Username | Password |
---|---|
Given by request | Given by request |
- Authorization send in http header:
Key | Value |
---|---|
X-Central-Code | Code value provide by GRID |
Methods
Incident detail
GET | /incident_management_report/incidents/external_id/{external_id} |
---|
Route Parameters
Parameter | Type | Required | Note |
---|---|---|---|
external_id | integer | yes | External Id of Incident |
Response structure: Incident Object
Example
GET: {Base API Url}/incident_management_report/incidents/external_id/HVFAWH1
Response example:
{
"id": 1,
"external_id": "HVFAWH1",
"closed_at": null,
"updated_at": "2022-02-10 08:53:14",
"deleted_at": "2023-02-10 08:53:14",
"status": 1
}
Incident create
POST | /incident_management_report/incidents/create |
---|
Route Parameters None.
Body Parameters
Parameter | Type | Required | Note |
---|---|---|---|
status | integer | yes | Incident status, integer enumerations:
|
external_id | string | optional | Validate unique if field filled. |
incident_datetime | datetime | yes | Incident time |
place | string | yes | Event location |
workplace_id | integer | optional | External Id of Incident. Validate exists if field filled. |
workplace_name | string | optional | Workplace mapping name. |
description | string | yes | Description of the incident |
suggestion | string | optional | Suggestion for improvement |
implemented_measures | string | optional | Immediate action |
title | title | optional | The incident title |
conclusion | string | optional | Conclusion |
created_by_user_id | integer | optional | User Id who is create incident, required if created_by_username not fill. |
created_by_username | string | optional | User email, who create incident |
officer_user_id | integer | optional | User responsible for incident |
closed_user_id | integer | optional | User close incident |
tag_ids | integer[] | optional | Example: [1, 2, 3] |
additional | object | optional |
Response structure:
{
"id": 999
}
Notes for “workplace_id” and “workplace_name”:
- If workplace_id does not exist, use workplace_name to find the corresponding workplace_id in DB to save.
Notes for “additional”:
- “additional” is an object consisting of one or multiple objects.
- Each child object is an object, which is used to add more information to tag or text fields (description, suggestion, implemented_measures).
- Child object needs to consist of specific attribute groups:
-
To add information to tag:
- connection = “tags”
- value: string value of tag.
-
To add information to text fields:
- append can be “description” or ”suggestion” or ”implemented_measures”
- append_label: string value of append label
- value: text to append to the field.
-
Example
POST: {Base API Url}/incident_management_report/incidents/create
Body request:
{
"status": 0,
"external_id": "External Id 11",
"incident_datetime": "2020-03-17 12:36:48",
"place": "A1 - Hovedstasjon",
"workplace_id": null,
"workplace_name":"WK_001",
"description": "Dette er beskrivelse av avvik.",
"implemented_measures": "Forslag til umiddelbart tiltak.",
"title": "Kort beskrivelse",
"suggestion": "",
"conclusion": "Konklusjon for avvik.",
"created_by_user_id": null,
"created_by_username": "test@bliksund.com",
"tag_ids": [],
"additional": {
"random_string_used_for_tag_1": {
"value": ["Tag name 3"],
"connection": "tags"
},
"random_string_used_for_tag_2": {
"value": ["Tag name 4"],
"connection": "tags"
},
"random_string_used_for_text_field": {
"value": "text",
"append": "description",
"append_label": "Kommentar"
}
}
}
Response example:
{
"id": 999
}
OHV specific usage
Example for how to use the API in the OHV project
Parameter | Type | Required | Note |
---|---|---|---|
110 sentral | Header | X-Central-Code | B03 |
Aviksnummer | Body | external_id | “ohv_1234” or “537692” |
OperatørID | Body | created_by_username | “username@domain.no” |
Hendelsestype | Body | Additional parameter | { "hendelsestype": { "value": ["Ulykke"], "connection": "tags" } } |
Type avvik (5 kategorier) | Body | Additional parameter | { "type avvik": { "value": ["Brann"], "connection": "tags" } } |
Problembeskrivelse | Body | description | |
Problemtittel | Body | title | |
Hendelsesadresse | Body | place | Eksempel: “Veien 2, 4879 Grimstad” |
Dato og tid | Body | incident_datetime | Eksempel: “2020-03-17 12:36:48" |
Kategori | Body | Additional parameter | { "kategori": { "value": ["Rød"], "connection": "tags" } } |
Revidert – Hendelsestype / subkriterier | Body | Additional parameter | { "subkriterier": { "value": ["Brann i bygning"], "connection": "tags" } } |
Stasjoner | Body | workplace_name | Eksempel: Brannstasjon 1 |
Kommentar | Body | Additional parameter | { "kommentar": { "value": ["kommentar som man vil oversende"], "append": "description", "append_label": "Sluttkomentar" } } |
Example
POST: {Base API Url}/incident_management_report/incidents/create
Request Header: X-Central-Code: B03
Request Body:
{
"status": 0,
"external_id": "ohv_1234",
"created_by_username": "username@domain.no",
"description": "Example OHV",
"title": "Example OHV",
"place": "Veien 2, 4879 Grimstad",
"incident_datetime": "2020-03-17 12:36:48",
"workplace_name": "Brannstasjon 1",
"additional": {
"hendelsestype": {
"value": ["Ulykke"],
"connection": "tags"
},
"type avvik": {
"value": ["Brann"],
"connection": "tags"
},
"kategori": {
"value": ["Rød"],
"connection": "tags"
},
"subkriterier": {
"value": ["Brann i bygning"],
"connection": "tags"
},
"kommentar": {
"value": ["kommentar som man vil oversende"],
"append": "description",
"append_label": "Sluttkomentar"
}
}
}