Gregw - I'm trying to convert my plugin from v1...
I'm trying to convert my plugin from v1 to v2 APIs, I think I understand the server side well enough, and I can see how client side works with websocket. But I can work out how to call a v2 API with a HTTP Put? So if I have a handler registered like
app.registerPutHandler('vessels.self', 'navigation.racing.startLinePort', setStartLinePort)
then what URL should I put to? /signalk/v2/api
with the body {context :"", path : "vessles.self.navigation.racing.startLinePort", value : newPosition}
? OR is the plugin name and the path in the URI and the body is just the value? I've tried several combinations and can't work it out. Any pointers (or links to relevant documentation) greatly appreciated!3 Replies
Put handlers still operate in v1
I'm still a little confused by v1 vs v2 and the URI space, but I've switched to using websocket from my client - which is giving me a much clearer understanding.
V2 APIs are REST.
If using the
PutHandler
method then you will send requests to the v1 path, so in your example /signalk/v1/api/vessels/self/navigation/racing/startLinePort