Protocol | Method | Endpoint | Topic | Description |
---|---|---|---|---|
HTTP | POST | /items | items-snapshots | Create an item. |
HTTP | PUT | /items/{id} | items-snapshots | Update item by the key. |
HTTP | DELETE | /items/{id} | items-snapshots | Delete item by the key. |
HTTP | GET | /items | items-snapshots | Fetch all items. |
HTTP | GET | /items/{id} | items-snapshots | Fetch item by the key. |
POST
request.
Note: You can remove -H 'Idempotency-Key: 1'
to generate random key.
curl -k -v -X POST http://localhost:7114/items -H 'Idempotency-Key: 1' -H 'Content-Type: application/json' -d '{"greeting":"Hello, world1"}'
output:
...
POST /items HTTP/2
Host: localhost:7143
user-agent: curl/7.85.0
accept: */*
idempotency-key: 2
content-type: application/json
content-length: 28
* We are completely uploaded and fine
* Connection state changed (MAX_CONCURRENT_STREAMS == 2147483647)!
HTTP/2 204
GET
request to fetch specific item.
curl -k -v http://localhost:7114/items/1
output:
...
* Connection state changed (MAX_CONCURRENT_STREAMS == 2147483647)!
< HTTP/2 200
< content-length: 27
< content-type: application/json
< etag: AQIACA==
<
* Connection #0 to host localhost left intact
{"greeting":"Hello, world1"}%
PUT
request to update specific item.
curl -k -v -X PUT http://localhost:7114/items/1 -H 'Content-Type: application/json' -d '{"greeting":"Hello, world2"}'
output:
...
PUT /items/1 HTTP/2
Host: localhost:7143
user-agent: curl/7.85.0
accept: */*
idempotency-key: 2
content-type: application/json
content-length: 28
* We are completely uploaded and fine
* Connection state changed (MAX_CONCURRENT_STREAMS == 2147483647)!
HTTP/2 204
DELETE
request to delete specific item.
curl -k -v -X DELETE http://localhost:7114/items/1
output:
...
> DELETE /items/1 HTTP/2
> Host: localhost:7143
> user-agent: curl/7.85.0
> accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 2147483647)!
< HTTP/2 204