ExamplesEvents
Get port visit events statistics in a region id (Senegal) (POST)
Example events statistics request for port visits in an existing region id, Senegal.
Request body
| Field | Value | Description |
|---|---|---|
confidences | ["3","4"] | Confidence levels of port visits to include |
datasets | ["public-global-port-visits-events:latest"] | Port visits events dataset |
startDate | 2018-01-01 | Start of the date range |
endDate | 2019-01-31 | End of the date range |
timeseriesInterval | YEAR | Timeseries aggregation interval |
region.dataset | public-eez-areas | Existing region dataset |
region.id | 8371 | Senegal EEZ region id |
Request
# Make sure to replace [TOKEN] with your API Access Token.
curl --location --request POST 'https://gateway.api.globalfishingwatch.org/v3/events/stats' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access-token}'
--header 'Content-Type: application/json' \
--data-raw '{
"confidences": [ "3","4"],
"datasets": [ "public-global-port-visits-events:latest"],
"startDate": "2018-01-01",
"endDate": "2019-01-31",
"timeseriesInterval": "YEAR",
"region": {
"dataset": "public-eez-areas",
"id": 8371
}
}
'result = await gfw_client.events.get_events_stats(
datasets=["public-global-port-visits-events:latest"],
timeseries_interval="YEAR",
start_date="2018-01-01",
end_date="2019-01-31",
confidences=["3", "4"],
region={
"dataset": "public-eez-areas",
"id": 8371,
},
)// Make sure to replace [TOKEN] with your API Access Token.
const res = await fetch('https://gateway.api.globalfishingwatch.org/v3/events/stats', {
method: 'POST',
headers: {
Authorization: 'Bearer [TOKEN]',
'Content-Type': 'application/json',
},
body: JSON.stringify({
confidences: ['3', '4'],
datasets: ['public-global-port-visits-events:latest'],
startDate: '2018-01-01',
endDate: '2019-01-31',
timeseriesInterval: 'YEAR',
region: {
dataset: 'public-eez-areas',
id: 8371,
},
}),
})
const data = await res.json()Response
{
"numEvents": 4366,
"numFlags": 72,
"numVessels": 1368,
"flags": [
"SWE",
"FRA",
"unknown",
"GIB",
"TZA",
"ATG",
"PRT",
"GRC",
"TUV",
"CAN",
"THA",
"NLD",
"ESP",
"NGA",
"COK",
"HRV",
"MNE",
"KNA",
"COM",
"BRB",
"HKG",
"GNB",
"GHA",
"CIV",
"SOM",
"CHN",
"TGO",
"LUX",
"UKR",
"SEN",
"KIR",
"CHE",
"VNM",
"VCT",
"KOR",
"SLV",
"DNK",
"BEL",
"MLT",
"TWN",
"DEU",
"AUS",
"USA",
"VUT",
"NOR",
"CYM",
"TUR",
"NIU",
"PHL",
"GBR",
"POL",
"BHS",
"SLE",
"SYC",
"CYP",
"BMU",
"AGO",
"PCN",
"BLZ",
"CPV",
"PLW",
"WLF",
"SGP",
"GIN",
"MHL",
"BES",
"WSM",
"RUS",
"ITA",
"GMB",
"MAR",
"LBR",
"PAN"
],
"timeseries": [
{
"date": "2018-01-01T00:00:00.000Z",
"value": 4003
},
{
"date": "2019-01-01T00:00:00.000Z",
"value": 363
}
]
}