Usage documentation

for the JDB Node container using the JDB webapp frontend


Current node rules


Authentication

Authentication can be done in using the following methods with JID as backend

The authenticated user will only have access to its own data. It is therefore safe to perform authentication directly from the end-users browser. The web server is not needed.



Commands

/path/to/resource?cmd=<action>

The URI contains the path to the content and supports the parameters

JDB support JSON data nodes and binary data nodes.
When storing JSON data in a node using content-type application/json, the returned data when retrieving multiple nodes will be un-encoded JSON.



Example 1 - inserting a binary image
HTTP POST /folder/8291/test.png
<body is binary content of test.png>



Example 2 - inserting JSON data and retrieving multiple values
HTTP POST /folder/8291/123
Content-type: application/json
<body is raw json>

HTTP POST /folder/8291/124
Content-type: application/json
<body is raw json>

Example 3 - retrieving JSON multiple data nodes
HTTP GET /folder/8291?cmd=iterate

Returned data will have content-type application/json in the following structure

{
123: { raw json data of first POST }
, 124: { raw json data of second POST }
}


If you iterate on the parent node /folder you will get

{
8291: {
  123: { raw json data of first POST }
  , 124: { raw json data of second POST }
 }
}

If you iterate on a node which contains binary data, the data will be json escaped.
If you request the single binary node, the response will be binary without any json.

Insert

curl -H "content-type: binary" --data-binary @/tmp/some.content -i "URL/folder/8291/test.png"


Return codes

HTTP/1.1 200 OK
HTTP/1.1 201 Exists
HTTP/1.1 500 Error


Update

curl -H "content-type: binary" --data-binary @/tmp/some.content -i "URL/folder/8291/test.png?cmd=update"

Return codes

HTTP/1.1 200 Updated
HTTP/1.1 404 Not found
HTTP/1.1 500 Error

Replace

curl -H "content-type: binary" --data-binary @/tmp/some.content -i "URL/folder/8291/test.png?cmd=replace"


Return codes

HTTP/1.1 200 Inserted
HTTP/1.1 201 Replaced
HTTP/1.1 500 Error


Delete

curl -i "URL/folder/8291/test.png?cmd=delete"


Return codes

HTTP/1.1 200 Deleted
HTTP/1.1 404 Not found
HTTP/1.1 403 Parent node does not exist

Select, end-node


curl -i "URL/folder/8291/test.png"

The body contains the content un-encoded.


Return codes

HTTP/1.1 200 OK
HTTP/1.1 404 Not found


Select, a node with children


curl -i "URL/folder/8291"

HTTP/1.1 200 OK
Content-type: application/json


{
"test": {
 "1": "some.content"
 , "123": "some.more.content" }
}

Warning: If you stored terrabytes of data in the nodes you will get terrabytes of JSON-encoded data in the response.


Iterate


curl -i "URL/folder/8291/tes?cmd=iterate"

Body will contain all nodes in 8291 starting with the key name tes