Skip to main content

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

Authentication

  • The API requires authentication with HTTP Basic Auth Type
  • You can use the account as below for testing
UsernamePassword
Given by requestGiven by request
  • Authorization send in http header:
KeyValue
X-Central-CodeCode value provide by GRID

Methods

Incident detail

GET/incident_management_report/incidents/external_id/{external_id}

Route Parameters

ParameterTypeRequiredNote
external_idintegeryesExternal 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

ParameterTypeRequiredNote
statusintegeryesIncident status, integer enumerations:
  1. Not Treated
  2. Under Treatment
  3. Closed
external_idstringoptionalValidate unique if field filled.
incident_datetimedatetimeyesIncident time
placestringyesEvent location
workplace_idintegeroptionalExternal Id of Incident. Validate exists if field filled.
workplace_namestringoptionalWorkplace mapping name.
descriptionstringyesDescription of the incident
suggestionstringoptionalSuggestion for improvement
implemented_measuresstringoptionalImmediate action
titletitleoptionalThe incident title
conclusionstringoptionalConclusion
created_by_user_idintegeroptionalUser Id who is create incident, required if created_by_username not fill.
created_by_usernamestringoptionalUser email, who create incident
officer_user_idintegeroptionalUser responsible for incident
closed_user_idintegeroptionalUser close incident
tag_idsinteger[]optionalExample: [1, 2, 3]
additionalobjectoptional

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:
    1. To add information to tag:

      • connection = “tags”
      • value: string value of tag.
    2. 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

ParameterTypeRequiredNote
110 sentralHeaderX-Central-CodeB03
AviksnummerBodyexternal_id“ohv_1234” or “537692”
OperatørIDBodycreated_by_usernameusername@domain.no
HendelsestypeBodyAdditional parameter{ "hendelsestype": { "value": ["Ulykke"], "connection": "tags" } }
Type avvik (5 kategorier)BodyAdditional parameter{ "type avvik": { "value": ["Brann"], "connection": "tags" } }
ProblembeskrivelseBodydescription
ProblemtittelBodytitle
HendelsesadresseBodyplaceEksempel: “Veien 2, 4879 Grimstad”
Dato og tidBodyincident_datetimeEksempel: “2020-03-17 12:36:48"
KategoriBodyAdditional parameter{ "kategori": { "value": ["Rød"], "connection": "tags" } }
Revidert – Hendelsestype / subkriterierBodyAdditional parameter{ "subkriterier": { "value": ["Brann i bygning"], "connection": "tags" } }
StasjonerBodyworkplace_nameEksempel: Brannstasjon 1
KommentarBodyAdditional 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"
}
}
}