String containing the target resource entry id. e.g. '07894aba-f151-4099-aa4f-5e5773734b99'
@example: resource request:
DELETE /signalk/v2/api/resources/routes/07894aba-f151-4099-aa4f-5e5773734b99
ResourceProvider method invocation:
deleteResource(
'07894aba-f151-4099-aa4f-5e5773734b99'
);
This method is called when a request is made for a specific resource entry with the supplied id
. If property
is supplied then the value of the resource property is returned. If there is no resource associated with the id the call should return Promise.reject.
String containing the target resource entry id. (e.g. '07894aba-f151-4099-aa4f-5e5773734b99')
Optional
property: stringName of resource property for which to return the value (in dot notation). e.g. feature.geometry.coordinates
GET /signalk/v2/api/resources/routes/07894aba-f151-4099-aa4f-5e5773734b99
ResourceProvider method invocation:
getResource(
'07894aba-f151-4099-aa4f-5e5773734b99'
);
Returns:
{
"name":"myRoute",
"description":"A Signal K route",
"distance":124226.65183615577,
"feature":{
"type":"Feature",
"geometry":{
"type":"LineString",
"coordinates":[[-8,-8],[-8.5,-8],[-8.5,-8.4],[-8.7,-8.3]]
},
"properties":{}
},
"timestamp":"2023-01-01T05:02:54.561Z",
"$source":"resources-provider"
}
GET /signalk/v2/api/resources/routes/07894aba-f151-4099-aa4f-5e5773734b99/feature/geometry/type
ResourceProvider method invocation:
getResource(
'07894aba-f151-4099-aa4f-5e5773734b99',
'feature.geometry.type'
);
Returns:
{
"value": "LineString",
"timestamp":"2023-01-01T05:02:54.561Z",
"$source":"resources-provider"
}
This method is called when a request is made for resource entries that match a specific criteria.
It is the responsibility of the resource provider plugin to filter the resources returned as per the supplied query parameters._
Object containing key | value
pairs representing the parameters by which to filter the returned entries. e.g. {region: 'fishing_zone'}
Return waypoints within the bounded area with lower left corner at E5.4 N25.7 & upper right corner E6.9 & N31.2:
GET /signalk/v2/api/resources/waypoints?bbox=[5.4,25.7,6.9,31.2]
ResourceProvider method invocation:
listResources(
{
bbox: '5.4,25.7,6.9,31.2'
}
);
Returns:
{
"07894aba-f151-4099-aa4f-5e5773734b69": {
"name":"my Point",
"description":"A Signal K waypoint",
"distance":124226.65183615577,
"feature":{
"type":"Feature",
"geometry":{
"type":"Point",
"coordinates":[5.7,26.4]
},
"properties":{}
},
"timestamp":"2023-01-01T05:02:54.561Z",
"$source":"resources-provider"
},
"0c894aba-d151-4099-aa4f-be5773734e99": {
"name":"another point",
"description":"Another Signal K waypoint",
"distance":107226.84,
"feature":{
"type":"Feature",
"geometry":{
"type":"Point",
"coordinates":[6.1,29.43]
},
"properties":{}
},
"timestamp":"2023-01-01T05:02:54.561Z",
"$source":"resources-provider"
}
}
This method is called when a request is made to save / update a resource entry with the supplied id. The supplied data is a complete resource record.
String containing the id of the resource entry created / updated. e.g. '07894aba-f151-4099-aa4f-5e5773734b99'
Resource data to be stored.
PUT /signalk/v2/api/resources/routes/07894aba-f151-4099-aa4f-5e5773734b99 {resource_data}
ResourceProvider method invocation:
setResource(
'07894aba-f151-4099-aa4f-5e5773734b99',
{
name: 'test route',
distance': 8000,
feature: {
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: [[138.5, -38.6], [138.7, -38.2], [138.9, -38.0]]
},
properties:{}
}
}
);
POST /signalk/v2/api/resources/routes {resource_data}
ResourceProvider method invocation:
setResource(
'<server_generated_id>',
{
name: 'test route',
distance': 8000,
feature: {
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: [[138.5, -38.6], [138.7, -38.2], [138.9, -38.0]]
},
properties:{}
}
}
);
This method is called when a request is made to remove the specific resource entry with the supplied resource id.