On this page

Insert data into a table

Insert a document/data into a table

Method : POST
URI : /db/mydb/my_table_test/doc
Body :

{
   "_pk": // primary key here, if key_type is Long then put long type else String
   "doc": // json doc
}

Example:

To put data into WIDE_TABLE (table_type = 1)

curl -H "Content-Type: application/json" -d '{"_pk":"user3","doc":{"name":"Arjun","org":"Google","likes":["books","basketball","food"]}}' -X POST http://192.168.1.105:18080/db/mydb/my_table_test/doc

Response

{
   "msg": "success"
}

To update the doc, we can the API with PUT method, that’s it

To put data (opaque data, in NORMAL_TABLE (table_type = 0) , we can same API, and in the “val” instead of json doc we can pass plain text or base64 data.

Example

curl -H "Content-Type: application/json" -d '{"_pk":"k1","doc":"This is plain text or opaque data"}' -X POST http://192.168.1.105:18080/db/mydb/normal_table/doc

Response

{
   "msg": "success"
}
Was this article helpful to you? Yes No