Skip to content
boneill42 edited this page Feb 7, 2012 · 1 revision

REST Commands

Create Keyspace (playground)

curl -X PUT http://localhost:8080/virgil/data/playground/ 

Create Column Family (toys)

curl -X PUT http://localhost:8080/virgil/data/playground/toys/

Set a Row (rowkey = "swingset", columns [ foo:1, bar:22 ])

curl -X PUT http://localhost:8080/virgil/data/playground/toys/swingset -d "{\"foo\":\"1\",\"bar\":\"33\"}"

Update a Row (rowkey = "swingset", columns [ foo:1, bar:22 ])

Updates columns with new values or adds columns if they don't exist.

curl -X PATCH http://localhost:8080/virgil/data/playground/toys/swingset -d "{\"foo\":\"3\",\"erg\":\"42\"}"

Fetch Row (rowkey = "swingset")

curl -X GET http://localhost:8080/virgil/data/playground/toys/swingset/

After running the commands above returns: {"erg":"42","foo":"3","bar":"33"}

Insert Column (rowkey = "swingset", columns [ snaf:lisa ])

curl -X PUT http://localhost:8080/virgil/data/playground/toys/swingset/snaf -d "lisa"

Patch Column Family with set of Rows

curl -X PATCH http://localhost:8080/virgil/data/playground/toys/ -d "{\"row1\":{\"column1\":\"1\"},\"row2\":{\"column1\":\"33\"}}"

Delete Column (rowkey = "swingset")

curl -X DELETE http://localhost:8080/virgil/data/playground/toys/swingset/snaf

Delete Row

curl -X DELETE http://localhost:8080/virgil/data/playground/toys/swingset/

Delete Column Family

curl -X DELETE http://localhost:8080/virgil/data/playground/toys/

Delete Keyspace

curl -X DELETE http://localhost:8080/virgil/data/playground/

Additional Headers

To specify consistency level, just include an additional HTTP header, "X-Consistency-Level" that specifies the level of required consistency for the operation. Below is an example used on a GET.

curl -X GET -H "X-Consistency-Level:ONE" http://localhost:8080/virgil/data/playground/toys/swingset/

Clone this wiki locally