mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Documentation/v2: add 'noValueOnSuccess' example
This commit is contained in:
parent
5c06fc9093
commit
ff7458508f
@ -559,6 +559,25 @@ Let's create a key-value pair first: `foo=one`.
|
|||||||
curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=one
|
curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=one
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"action":"set",
|
||||||
|
"node":{
|
||||||
|
"key":"/foo",
|
||||||
|
"value":"one",
|
||||||
|
"modifiedIndex":4,
|
||||||
|
"createdIndex":4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Specifying `noValueOnSuccess` option skips returning the node as value.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl http://127.0.0.1:2379/v2/keys/foo?noValueOnSuccess=true -XPUT -d value=one
|
||||||
|
# {"action":"set"}
|
||||||
|
```
|
||||||
|
|
||||||
Now let's try some invalid `CompareAndSwap` commands.
|
Now let's try some invalid `CompareAndSwap` commands.
|
||||||
|
|
||||||
Trying to set this existing key with `prevExist=false` fails as expected:
|
Trying to set this existing key with `prevExist=false` fails as expected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user