Giter Site home page Giter Site logo

Comments (11)

rob42 avatar rob42 commented on August 16, 2024

Also when saving resources they are in the root of the signalk tree, not under vessels. Hence the PUT should be to

/signalk/v1/api/resources/waypoints/urn:mrn:signalk:uuid:66d0...94f83

and not

/signalk/v1/api/vessels/self/resources/waypoints/urn:mrn:signalk:uuid:66d...94f83

from freeboard-sk.

panaaj avatar panaaj commented on August 16, 2024

Freeboard currently uses http PUT by default for sending resources to the server.
The other option is to use web socket UPDATE messages.
Websocket PUT is not currently used.

HTTP PUT does actually target ..../vessels/self/resources.

This is more than likely a mis-alignment between my GPXLoad plugin operation (on node-server) and Artemis. Most likely due to the way I have interpreted the spec and the assumptions made to fill in the gaps.

Seems like an opportunity to align things.

from freeboard-sk.

rob42 avatar rob42 commented on August 16, 2024

Ive just merged SignalK/specification#523 into specification which clarifies the PUT message and makes vessels.self as the default context. But thinking about your case above when there is no context...
So thats broken already :-(

I'll fix it now, vessels.self should not be a default context as it makes absolute paths like /resources difficult. Easier to include vessels.self when you want that then it is for the server to decide when its needed or not.

from freeboard-sk.

rob42 avatar rob42 commented on August 16, 2024

SignalK/specification#536

from freeboard-sk.

panaaj avatar panaaj commented on August 16, 2024

@rob42 given SignalK/specification#536 refers to websocket PUT and freeboard uses HTTP PUT, can this issue be closed?

from freeboard-sk.

rob42 avatar rob42 commented on August 16, 2024

No I dont think so.
I think the http PUT is targeting the /vessels/self path when it should not.
Hence the PUT should be to

/signalk/v1/api/**resources/waypoints/**urn:mrn:signalk:uuid:66d0...94f83

and not

/signalk/v1/api/**vessels/self/**resources/waypoints/urn:mrn:signalk:uuid:66d...94f83

Also see SignalK/specification#538 which superceeds SignalK/specification#536

from freeboard-sk.

panaaj avatar panaaj commented on August 16, 2024

I have raised a question on Slack plugins channel as currently the GPXLoad plugin cannot accept a put to /signalk/v1/api/resources/waypoints or /signalk/v1/api/resources/routes.
If there is no immediate answer it may be that a change might be requires in node server to allow this.

Once GPXLoad plugin can accept a put to the correct path I will update Freeboard to use the correct path.

from freeboard-sk.

tkurki avatar tkurki commented on August 16, 2024

This confusion stems from trying to do HTTP over ws, when simple REST would work:

  • POST to /signalk/v1/api/resources/waypoint/ to create a new route, the server responds with 201 created and Location of the created route
  • PUT to /signalk/v1/api/resources/waypoint/<sk uuid> to modify an existing route or to add a new one with an id that the client already knows
  • DELETE to /signalk/v1/api/resources/waypoint/<sk uuid> to delete a route

from freeboard-sk.

rob42 avatar rob42 commented on August 16, 2024

See https://stackoverflow.com/questions/630453/put-vs-post-in-rest
It should be possible to create with a PUT, which also simplifies the code so you dont need to consider if a waypoint is being updated or created, just PUT it anyway.

Also with a default /vessels/self the server will try to execute

PUT /signalk/v1/api/vessels/self/resources/waypoint/

unless you add code to explicitly check and correct for known root paths. See #538

from freeboard-sk.

tkurki avatar tkurki commented on August 16, 2024

It should be possible to create with a PUT

Sure, this is why I said add a new one in my comment above.

Also with a default /vessels/self the server will try to execute
PUT /signalk/v1/api/vessels/self/resources/waypoint/

No. context plays no role when you use http.

from freeboard-sk.

panaaj avatar panaaj commented on August 16, 2024

Have raised /signalk-server-node/issues/738 to address HTTP PUT to /signalk/v1/api/vessels/self/resources/* path issue.

from freeboard-sk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.