Skip to content

Commit

Permalink
Documentation/dev-guide: add example of txn target VERSION syntax for…
Browse files Browse the repository at this point in the history
… gRPC-gateway.
  • Loading branch information
hexfusion committed Sep 23, 2018
1 parent d987cae commit e935594
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Documentation/dev-guide/api_grpc_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,21 @@ curl -L http://localhost:2379/v3/kv/put \
Issue a transaction with `/v3/kv/txn`:

```bash
# target CREATE
curl -L http://localhost:2379/v3/kv/txn \
-X POST \
-d '{"compare":[{"target":"CREATE","key":"Zm9v","createRevision":"2"}],"success":[{"requestPut":{"key":"Zm9v","value":"YmFy"}}]}'
# {"header":{"cluster_id":"12585971608760269493","member_id":"13847567121247652255","revision":"3","raft_term":"2"},"succeeded":true,"responses":[{"response_put":{"header":{"revision":"3"}}}]}
```

```bash
# target VERSION
curl -L http://localhost:2379/v3/kv/txn \
-X POST \
-d '{"compare":[{"version":"4","result":"EQUAL","target":"VERSION","key":"Zm9v"}],"success":[{"requestRange":{"key":"Zm9v"}}]}'
# {"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"6","raft_term":"3"},"succeeded":true,"responses":[{"response_range":{"header":{"revision":"6"},"kvs":[{"key":"Zm9v","create_revision":"2","mod_revision":"6","version":"4","value":"YmF6"}],"count":"1"}}]}
```

### Authentication

Set up authentication with the `/v3/auth` service:
Expand Down

0 comments on commit e935594

Please sign in to comment.