The Grounding detector is used to detect when a ship unintentionally makes contact with the seabed or an underwater obstruction. In marine informatics, grounding events serve as an important indicator of navigational safety and operational risk, as they identify when and where an impact occurs.
This article will explain how to interact with the Gatehouse Maritime API to create, read, update, or delete grounding detectors, with concrete code examples of how to do it.
Content overview:
The base URL for the following endpoints is:
https://demo.ghmaritime.com/api/ingress/grounding
To create a grounding detector a configuration needs to be specified.
A configuration defines what type of events the grounding detector should notify the user about, how severe the event is, and where to send the alert.
The endpoint for creating configurations is:
/configurations
This is defined as a payload that uses several parameters.
The following is a list of parameters that can be configurated in the payload:
GeoJson structure:
"geometry": {
"geometry": {
"coordinates": [
[
[
-78.77392578124999,
27.39828335627755
],
[
-71.74267578125001,
22.62129400565829
],
[
-73.63232421875,
20.41381508026815
],
[
-80.97119140625001,
24.3542846683067
],
[
-78.77392578124999,
27.39828335627755
]
]
],
"type": "Polygon"
},
"properties": {
"name": "TEST_SHAPE"
},
"type": "Feature"
}
This was the number of available parameters to be used in the payload. The following is an example of some test payload in python:
payload = {
"name": "detector",
"enabled": True,
"parameters": {
"use_in_same_location": True,
"use_stop_check": True,
"use_shallow_waters": True,
"use_sog_decrease": True,
"use_nav_stat": False,
"validate_minutes": 15,
"filter_ports": True,
"filter_anchorage_areas": True,
"use_remains_grounded_check": True
},
"severity": "Note",
"shape": "2504644d-b0cd-4c25-984e-70376685c32a",
"type": "grounding",
"phone_numbers": ["12345678"],
"email_addresses": ["some_mail@provider.com"],
"message": "string",
"groundings": []
}
Now it is possible to create a configuration through the API, where the API will simultaneously create an event detector with the configuration.
import requests
import json
URL = (
f"https://demo.ghmaritime.com/api/ingress/grounding/configurations"
)
headers = {
"Authorization": "Basic <credentials>",
"Content-Type": "application/json"
}
payload = {
"name": "detector",
"enabled": True,
"parameters": {
"use_in_same_location": True,
"use_stop_check": True,
"use_shallow_waters": True,
"use_sog_decrease": True,
"use_nav_stat": False,
"validate_minutes": 15,
"filter_ports": True,
"filter_anchorage_areas": True,
"use_remains_grounded_check": True
},
"severity": "Note",
"shape": "2504644d-b0cd-4c25-984e-70376685c32a",
"type": "grounding",
"phone_numbers": ["12345678"],
"email_addresses": ["some_mail@provider.com"],
"message": "string",
"groundings": []
}
response = requests.post(URL, headers=headers, json=payload)
print(response.status_code)
response.raise_for_status()
print(json.dumps(response.json(), indent=2))
201
{
"id": 35,
"uuid": "cb3598ed-8442-4b90-9ebf-d2af320ae857",
"created_at": "2025-11-17T08:56:02.783582Z",
"created_by": "user",
"modified_at": "2025-11-17T08:56:02.783660Z",
"modified_by": "user",
"name": "detector",
"enabled": false,
"parameters": {
"use_in_same_location": true,
"use_stop_check": true,
"use_shallow_waters": true,
"use_sog_decrease": true,
"use_nav_stat": false,
"validate_minutes": 15,
"filter_ports": true,
"filter_anchorage_areas": true,
"use_remains_grounded_check": true
},
"severity": "Note",
"shape": "2504644d-b0cd-4c25-984e-70376685c32a",
"geometry": null,
"acl": [],
"acl_put": [],
"type": "grounding",
"phone_numbers": [
"12345678"
],
"email_addresses": [
"some_mail@provider.com"
],
"message": "string",
"groundings": []
}
Now, an event detector has been created with the specified definition.
To read events from a grounding detector, create a GET request via the /groundings/{ID} endpoint where the id variable is the id of the grounding detector. Additionally, it is possible to get all events by constructing a request via the /groundings endpoint where id is not specified but several parameters are specified instead.
As a prerequisite for this, the id of the detector should be known. If it is not known, see Get Definitions of all available Event Detector to find the id of the wanted detector.
Endpoint url:
/groundings/{ID}
Now, it is possible to use the id of the detector to get the events from the detector.
import requests
import json
URL = (
f"https://demo.ghmaritime.com/api/ingress/grounding/groundings"
)
headers = {
"Authorization": "Basic <credentials>",
"Content-Type": "application/json"
}
parameters = {
"id": "<uuid>"
}
response = requests.get(URL, headers=headers, params=parameters)
print(response.status_code)
response.raise_for_status()
print(json.dumps(response.json(), indent=2))
200
{
"items": [
{
"id": 4,
"uuid": "81587c04-2f9d-4acb-91fa-d01fe44fe1c3",
"created_at": "2025-04-01T09:48:52.135822Z",
"created_by": "grounding",
"modified_at": "2025-09-29T07:29:00.262567Z",
"modified_by": "grounding",
"mmsi": 123456789,
"grounding_point": {
"type": "Point",
"coordinates": [
102.0,
0.5
]
},
"grounding_time": "2021-01-01T00:00:00Z",
"release_time": "2025-09-29T03:02:25Z",
"vessel_name": "MAZUNTE",
"imo": 7738618,
"call_sign": null,
"configuration_ids": [
2,
36,
5,
19,
28,
29
],
"configurations": []
}
],
"total": 1,
"page": 1,
"size": 50,
"pages": 1
}
To update a grounding detector, construct a PUT request via the /configurations/{ID} endpoint where the request body specifies the new updated detector.
Endpoint url:
/configurations/{ID}
To see the descriptions of the parameters for the configurations, go to this list.
Additionally, the id of the detector should be known, if it is not known, see Get Definitions of all available Event Detector to get the id of the detector.
The following is an example of the payload that defines the configuration of the detector:
payload = {
"name": "detector",
"enabled": True,
"parameters": {
"use_in_same_location": True,
"use_stop_check": True,
"use_shallow_waters": True,
"use_sog_decrease": True,
"use_nav_stat": False,
"validate_minutes": 15,
"filter_ports": True,
"filter_anchorage_areas": True,
"use_remains_grounded_check": True
},
"severity": "Note",
"shape": "2504644d-b0cd-4c25-984e-70376685c32a",
"acl": [
"<uuid>"
],
"acl_put": [
"<uuid>"
],
"type": "grounding",
"phone_numbers": ["12345678"],
"email_addresses": ["some_mail@provider.com"],
"message": "string",
"groundings": []
}
It is important to note that the request body must contain the acl and acl_put fields where they should contain the uuid of the event detector that is being updated.
import requests
import json
URL = (
f"http://mdmtest.gatehouse.local/api/ingress/grounding/configurations/<configuration_id>"
)
headers = {
"Authorization": "Basic <credentials>",
"Content-Type": "application/json"
}
payload = {
"name": "detector",
"enabled": True,
"parameters": {
"use_in_same_location": True,
"use_stop_check": True,
"use_shallow_waters": True,
"use_sog_decrease": True,
"use_nav_stat": False,
"validate_minutes": 15,
"filter_ports": True,
"filter_anchorage_areas": True,
"use_remains_grounded_check": True
},
"severity": "Note",
"shape": "2504644d-b0cd-4c25-984e-70376685c32a",
"acl": [
"5c5fe6f3-fc4d-4418-9b22-658fd7d63d71"
],
"acl_put": [
"5c5fe6f3-fc4d-4418-9b22-658fd7d63d71"
],
"type": "grounding",
"phone_numbers": ["12345678"],
"email_addresses": ["some_mail@provider.com"],
"message": "string",
"groundings": []
}
response = requests.get(URL, headers=headers, params=parameters)
print(response.status_code)
response.raise_for_status()
print(json.dumps(response.json(), indent=2))
200
{
"id": 36,
"uuid": "6c5fe6f3-fc4d-4418-9b22-658fd7d63d71",
"created_at": "2025-11-17T09:08:01.153926Z",
"created_by": "mae",
"modified_at": "2025-11-17T10:08:08.381781Z",
"modified_by": "mae",
"name": "detector",
"enabled": true,
"parameters": {
"use_in_same_location": true,
"use_stop_check": true,
"use_shallow_waters": true,
"use_sog_decrease": true,
"use_nav_stat": false,
"validate_minutes": 15,
"filter_ports": true,
"filter_anchorage_areas": true,
"use_remains_grounded_check": true
},
"severity": "Note",
"shape": "2504644d-b0cd-4c25-984e-70376685c32a",
"geometry": null,
"acl": [
"6c5fe6f3-fc4d-4418-9b22-658fd7d63d71"
],
"acl_put": [
"6c5fe6f3-fc4d-4418-9b22-658fd7d63d71"
],
"type": "grounding",
"phone_numbers": [
"12345678"
],
"email_addresses": [
"some_mail@provider.com"
],
"message": "string",
"groundings": []
}
Now, the detector in the system should have been updated with the specified changes.
To delete a grounding event detector, construct a DELETE request via the /configurations/{ID} endpoint, where id is the identification number of the detector.
Endpoint URL:
/configurations/{id}
The API will only respond with a response status, and not a Json object.
It should be mentioned that in order to delete a detector, the id of the detector should be known. If this is not the case, see Get Definitions of all available Event Detector to get the id of the detector.
import requests
import json
URL = (
f"http://mdmtest.gatehouse.local/api/ingress/grounding/configurations/1"
)
headers = {
"Authorization": "Basic <credentials>",
"Content-Type": "application/json"
}
response = requests.delete(URL, headers=headers)
print(response.status_code)
response.raise_for_status()
204
Now, the event detector should be deleted from the system.