-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: add resources section #540
Comments
You have several instances of |
It seems (according to #218) that resources have been moved to a top level path from under Should there be something like |
See https://stackoverflow.com/questions/630453/put-vs-post-in-rest which discusses the convention that POST creates, so POST a note (body) to So convention says a POST to Given we have [uuid]s at various branches of the ever growing signalk data model, there is some complexity in trying to decide if a path is valid for a POST, and supporting all the paths potentially used by an app. In a simple implementation you just append at |
Typically the signalk db will be on a vessel, eg on |
eg consider when cruising notes for a bay are scattered across potentially dozens of vessels.[uuid], and then you want to reshare them. Then some-one else reshares the note back...much simpler at the top level. Same with charts etc |
|
So if they are made public should they appear under a separate path? |
So for resources then:
Then can |
public and private resources use same path, just apply security rules to filter the results. |
What do you mean with In what cases would context matter here? Why should it be self? |
There is no |
I guess that's my question... does context actually apply here? I'd like to see it as straight forward as possible. |
Getting back to my post above:
I would prefer we just use POST (with no path) to post a full signalk message same as we use in websockets, and use PUT for create/edit via http. It avoids a very complex area of uuids that is bound to give lots of pain to everyone. |
I agree. The path should include /vessels/self/.., the idea that /vessels/self is a default is another can of worms when you start to use /resources, /aircraft, etc. One more complex bit of code and lots of implementation errors |
So something like
|
What if someone does this:
Actually PUT has the same issue...security rules will be needed... |
That's why I feel there needs to be a specific resources section to spell out how to use them and how these cases are expected to be handled, as has been done in request/response. |
Use the original post you have above, edit for this discussion and add it as a gitbook page. Make a pull request. And write what works for you - if any-one disagrees they can comment on the PR. |
Will do |
I cannot push the |
Doesn’t normal push to fork then PR work? |
Success... PR created.. #541 |
The specification could benefit from the addition of a Resources section to describe the way in which to work with these data items. (Noted: that #218 has a similar subject)
I have included below an example of possible content that is modelled on existing specification content and aligns with the current
PUT
section to help start the conversation.Resources
Resources are collections of objects that are used to represent data that serves as
additional information to aid with navigation etc.
Resources are:
/signalk/v1/api/resources/routes/36f9b6b5-959f-46a1-8a68-82159742aadd
)Making a Request to Create, Update or Delete a Resource Entry
Requests are sent to a server to create, update or delete resource entries.
See Request/Response for more details on request/response in Signal K.
CREATING a Resource Entry
To create a resource entry, a POST request should be sent via HTTP or using a Signal K put delta.
The
source
field is optional. If a request is sent without the source and there is more than one source for thevalue, the server should respond with a 400 (Bad Request) HTTP status code.
Via HTTP
Via a Delta
The
context
key is optional, and defaults tovessels.self
, which is the usual case. You can include it to be able to set values on other vessels.UPDATING a Resource Entry
To update a resource entry, a PUT request should be sent via HTTP or using a Signal K put delta.
Via HTTP
Via a Delta
DELETING a Resource Entry
To delete a resource entry, a DELETE request should be sent via HTTP or using a Signal K put delta with a value of null.
Via HTTP
Via a Delta
Querying Resource Entries
As resource groups can potentially hold a large number of entries there needs to be a way of returning a subset of entries from the relevant
/resources/<resource_group>
path.The text was updated successfully, but these errors were encountered: