Skip to content
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

fix: clarify PUT use #592

Merged
merged 1 commit into from
Oct 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions gitbook-docs/put.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# PUT Requests

PUT requests are sent to a server to request a change to a value. For example, a client would use PUT to switch the
anchor light on or off, change the heading of the autopilot, or set position of the anchor.
PUT requests are sent to a server to request an action to be taken. For example, a client would use PUT to switch the anchor light on or off, change the heading of the autopilot, or change the current input on a stereo.
tkurki marked this conversation as resolved.
Show resolved Hide resolved

Note that this is very different than updating the current state of something. Use a delta update message to report the current / updated value of something, for example to report on the current wind speed from a sensor. See [Delta Format](data_model.md)

See [Request/Response](request_response.md) for more details on request/response in Signal K.

## Making a Request to Change a Value
## Making a Request To Take an Action

To change a value, a PUT request should be sent via HTTP or using a Signal K __put__ delta.
tkurki marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -23,7 +24,7 @@ PUT http://localhost:3000/signalk/v1/api/vessels/self/steering/autopilot/target/

### Via a Delta

[>]: # (mdpInsert ```json fsnip ../data/put-valid/delta-put-array.json)
[>]: # (mdpInsert ```json fsnip ../test/data/put-valid/delta-put-array.json)
```json
{
"context": "vessels.urn:mrn:signalk:uuid:6b0e776f-811a-4b35-980e-b93405371bc5",
Expand All @@ -42,7 +43,7 @@ The `context` key is optional, and defaults to `vessels.self`, which is the usua
The above PUT request (v1) uses an array to allow multiple keys in a single PUT. This is deprecated and strongly discouraged as it causes complex problems
with the request/response semantics in cases of partial failures. An alternative format has been added to the v1 specification where the PUT request is:

[>]: # (mdpInsert ```json fsnip ../data/put-valid/delta-put-no-array.json)
[>]: # (mdpInsert ```json fsnip ../test/data/put-valid/delta-put-no-array.json)
```json
{
"context": "vessels.urn:mrn:signalk:uuid:6b0e776f-811a-4b35-980e-b93405371bc5",
Expand Down