ExamplesInsights
Get insights for a vessel related to AIS off events
Example Insights request returning AIS off (gap) indicators for one vessel over a date range.
Request body
| Field | Value | Description |
|---|---|---|
includes | ["GAP"] | Insight type to include: AIS off events |
confidences | [] | Confidence levels to filter AIS off events by |
startDate | 2022-07-11 | Start of the period to analyze |
endDate | 2023-07-11 | End of the period to analyze |
vessels[0].datasetId | public-global-vessel-identity:latest | Vessel identity dataset |
vessels[0].vesselId | 2339c52c3-3a84-1603-f968-d8890f23e1ed | Vessel id to get insights for |
Request
# Make sure to replace [TOKEN] with your API Access Token.
curl --location --request POST 'https://gateway.api.globalfishingwatch.org/v3/insights/vessels' \
--header 'Authorization: Bearer [TOKEN]' \
--header 'Content-Type: application/json' \
--data-raw '{
"includes": [ "GAP"],
"confidences": [],
"startDate": "2022-07-11",
"endDate": "2023-07-11",
"vessels": [
{"datasetId":"public-global-vessel-identity:latest","vesselId":"2339c52c3-3a84-1603-f968-d8890f23e1ed"}
]
}'result = await gfw_client.insights.get_vessel_insights(
includes=["GAP"],
start_date="2022-07-11",
end_date="2023-07-11",
vessels=[
{
"datasetId": "public-global-vessel-identity:latest",
"vesselId": "2339c52c3-3a84-1603-f968-d8890f23e1ed",
}
],
)// Make sure to replace [TOKEN] with your API Access Token.
const res = await fetch('https://gateway.api.globalfishingwatch.org/v3/insights/vessels', {
method: 'POST',
headers: {
Authorization: 'Bearer [TOKEN]',
'Content-Type': 'application/json',
},
body: JSON.stringify({
includes: ['GAP'],
confidences: [],
startDate: '2022-07-11',
endDate: '2023-07-11',
vessels: [
{
datasetId: 'public-global-vessel-identity:latest',
vesselId: '2339c52c3-3a84-1603-f968-d8890f23e1ed',
},
],
}),
})
const data = await res.json()Response
{
"period": {
"startDate": "2022-07-11",
"endDate": "2023-07-11"
},
"gap": {
"datasets": ["public-global-gaps-events:v3.0"],
"historicalCounters": {
"events": 1,
"eventsGapOff": 1
},
"periodSelectedCounters": {
"events": 1,
"eventsGapOff": 1
},
"aisOff": ["9ce75aa2a483a06f41155132b83dc744"]
}
}