Gathering historical data is essential for analyzing the causality of past events. The API facilitates this by providing easy access to historical data through the creation and modification of reports. By reviewing and analyzing these reports, users can identify the underlying causes of specific events.
This article will cover the creation of reports and how to view their output:
The base url for the mentioned endpoints throughout the article is:
https://demo.ghmaritime.com/api/jobserver
There are several types of reports that can be created through the API; their functionality is similar regarding the construction of the request body, however they differentiate in some fields and of course their endpoints.
Every request body should include the following fields:
{
"name": "{name}"
"begin": "{year}-{hour}-{minute}T{hour}:{minute}:{seconds}Z",
"end": "{year}-{hour}-{minute}T{hour}:{minute}:{seconds}Z",
}
The types of reports are listed below, along with their respective endpoint and what they require as extra in their request body:
/stat/multiship
/stat/portcalls
/stat/sogdist
/stat/fishing
When a report has been created, the API will respond with a JSON object containing the id of the created report, which can then be used to get the specification of the report or its’ result. To read more about this, see Get Output from a Specific Report
Visualization of creating a report:
To get the output from a specific report, the id of the report is needed; if the id is unknown or no report has been created beforehand, follow the steps at Create a Report.
There are two endpoints to get output from a specific report, the first is to get the specification of the report;
/stat/{type}/{id}
the second is to get the result of the report:
/stat/{type}/result/{id}
Please note that a report must be completed before its result is available, which may take a few minutes after its creation.
The {type} value in the URLs should be replaced with one of the following values:
The API will respond with a JSON object that contains a record list of what happened during the specified time frame of the report.
Visualization of getting the report definition:
Visualization of getting the report result: