io7m | single-page | multi-page | epub | Looseleaf User Manual
8.1. Generalities
Previous
8. Protocol V1
Up
8.3. /v1/read
Next

# 8.2. /v1/rud

- 8.2.1. Name
- 8.2.2. Description
- 8.2.3. Examples

## 8.2.1. Name

1
/v1/rud - Atomically read, update, and delete sets of keys

## 8.2.2. Description

1
The /v1/rud endpoint performs a read-update-delete operation. The endpoint requires a JSON object containing three properties: read, update, and delete. The read property is an array-typed property containing a list of key names that will be read. The update property is a JSON object where the properties names are key names, and the property values are key values; the key names mentioned will be set to the corresponding values. The delete property is an array-typed property containing a list of key names to be deleted.

### 8.2.2.2. Example Object

    {
      "read": [
        "/x/y/z"
      ],
      "update": {
        "/x/y/z": "24"
      },
      "delete": []
    }

3
On success, the endpoint returns a JSON object with a values property that contains the values of the keys specified by the original read property.

### 8.2.2.4. Example Values

    {
      "values": {
        "/x/y/z": "before"
      }
    }

## 8.2.3. Examples

1
The following command reads the value of /x/y/z, then sets the value of /x/y/z to "after":

### 8.2.3.2. Example Read/Update

    $ curl -u grouch:12345678 -d '{"read":["/x/y/z"],"update":{"/x/y/z":"after"},"delete":[]}' http://localhost:20000/v1/rud
    {"values":{"/x/y/z":"before"}}

3
The following command deletes /x/y/z:

### 8.2.3.4. Example Read/Update

    $ curl -u grouch:12345678 -d '{"read":[],"update":{},"delete":["/x/y/z"]}' http://localhost:20000/v1/rud
    {"values":{}}

5
The following command updates/creates all of /x/y/a, /x/y/b, and /x/y/c atomically:

### 8.2.3.6. Example Read/Update

    $ curl -u grouch:12345678 -d '{"read":[],"update":{"/x/y/a":"q","/x/y/b":"w","/x/y/c":"x"},"delete":[]}' http://localhost:20000/v1/rud
    {"values":{}}

8.1. Generalities
Previous
8. Protocol V1
Up
8.3. /v1/read
Next
io7m | single-page | multi-page | epub | Looseleaf User Manual