signalk-flags
v1.0.2
Published
Country Flags plugin for Signal K server.
Downloads
38
Readme
Signal K Flag Resources Plugin:
About
Signal K server plugin that:
- Makes country flag images (svg) images available under
/signalk/v2/api/resources/flags - Populates both the
flagandportattributes for a vessel based on the received MMSI value.
HTTP API endpoints
Flag images (in svg format) can be retrieved by making HTTP requests to the available API endpoints, the definitions of which can be found in the Signal K Admin Console by clicking on OpenAPI and selecting plugins/signalk-flags.
Using MMSI
/signalk/v2/api/resources/flags/mmsi/{vessel_mmsi}
Example: Return flag image for the MMSI = 211456789
HTTP GET "/signalk/v2/api/resources/flags/mmsi/211456789Using Country Code
/signalk/v2/api/resources/flags/country/{country_code}
country_code = two-character country code
Example: Return the New Zealand flag image
HTTP GET "/signalk/v2/api/resources/flags/country/nz"Vessel Schema Atttributes
The plugin also populates both the flag and port attributes for a vessel based on the received MMSI value as follows:
flag= two letter country code (e.g. "DE")port= name of the country (e.g. "Germany")
The attributes are then available as part of the Signal K data model and can be retrieved along with other vessel data.
Example: Fetch vessel details via HTTP request to Signal K API
HTTP GET "vessels.urn:mrn:signalk:uuid:eec3888d-5925-4e81-b6d4-3d2ff98edeeb"Example Response:
{
"mmsi": 211456789,
"name": "My Vessel",
"flag": "DE",
"port": "Germany"
... // remainder of vessel data
}