Skip to content

Posting Raw JSON over HTTP

edwardcapriolo edited this page Feb 11, 2013 · 5 revisions

Those who do not have Java, c++, libraries, or even a compiler it is still possible to work with Cassandra through IntraVert. Since IntraVert is build on http and accepts Json payloads it is easy to work with. Example

curl -H "Content-Type: application/json" -X POST --data @cql.json localhost:8080/:appid/intrareq-json

where cql.json looks like:

{"e":[
  {
    "type": "SETKEYSPACE",
    "op": {
      "keyspace": "system"
    }
  },
  {
    "type":"CQLQUERY",
    "op": {
      "version": "3.0.0",
      "query": "CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
      'replication_factor': 1}"
     }
   }
 ]}

An extensive example of using JSON is available in the unit tests: see https://github.com/zznate/intravert-ug/blob/master/src/test/java/org/usergrid/vx/experimental/RawJsonITest.java