Etcd: interacting with etcd V3 cluster using CURL CLI

Created on 23 Jul 2019  路  5Comments  路  Source: etcd-io/etcd

Is there any user guide which details the CURL commands with which we can do CRUD operations on ETCD v3 ? Specifically I am interested in CURL commnd URL required for DLETE (or DEL RANGE) operation.

arequestion

All 5 comments

I tried the command curl -v -s http://127.0.0.1:2379/v3/kv/deleteRange -X POST -d "@2.json" with 2.json has the key and range_end in base64 format. But I am getting 404 (Not Found) error code. But the key exists and I could run curl -v -s http://127.0.0.1:2379/v3/kv/range -X POST -d "@2.json" successfully. How to carry out the delete through curl?

@vnagineni deleterange should work e.g. something like:

curl http://localhost:2379/v3/kv/deleterange -X POST -d '{"key": "test"}'
{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"15","raft_term":"18"},"deleted":"1"}

Couple of related doc links:
https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/api_reference_v3.md#service-kv-etcdserveretcdserverpbrpcproto
https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/api_grpc_gateway.md

@vnagineni deleterange should work e.g. something like:

curl http://localhost:2379/v3/kv/deleterange -X POST -d '{"key": "test"}'
{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"15","raft_term":"18"},"deleted":"1"}

Couple of related doc links:
https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/api_reference_v3.md#service-kv-etcdserveretcdserverpbrpcproto
https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/api_grpc_gateway.md

curl http://localhost:2379/v3/ - shouldn't this be curl http://localhost:2379/v3beta/ ?

https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/api_grpc_gateway.md

Depends on your version - etcd v3.4 uses [CLIENT-URL]/v3/* while keeping [CLIENT-URL]/v3beta/* as mentioned in your link.

@vnagineni hope the answer helped, closing the issue. Please feel free to reopen if needed. Thanks!

Was this page helpful?
0 / 5 - 0 ratings