Skip to content

REST: Databags related api

rsvato edited this page Mar 20, 2013 · 10 revisions

List databags

Path: /rest/databags/, rest/projects/(projectId)/databags

Type: GET

Example results:

[{"id":1,"genesis database":"asdf","tags":["database", "genesis"], "templateId":"system-database"}]

Get databag with properties

Path: /rest/databags/(databagId), /rest/projects/(projectId)/databag/(databagId)

Type: GET

Example results:

{
  "id":1,
  "name":"genesis-app-database",
  "tags":["genesis","database"],
  "templateId":"system-database",
  "items":[
        {
          "id":2,
          "name":"jdbc.password",
          "value":"",
          "dataBagId":1
        },
       {
          "id":1,
          "name":"jdbc.url",
          "value":"jdbc:h2:mem:genesisBackendInMemoryStore;DB_CLOSE_DELAY=-1",
          "dataBagId":1
       },
       {
          "id":3,
          "name":"jdbc.username",
          "value":"root",
          "dataBagId":1
       }
   ]
}

Create databag

Path: /rest/databags/, rest/projects/(projectId)/databags

Type: POST

Example results:

Error on creation: common result object

Successful creation: common successfull result object

Input data:

{ 
    "name":"genesis-app-database",
    "tags":["genesis","database"],
    "items":[
        {"name":"jdbc.password", "value":""},
        {"name":"jdbc.url", "value":"jdbc:h2:mem:genesisBackendInMemoryStore;DB\_CLOSE\_DELAY=-1" },
        {"name":"jdbc.username", "value":"root"}
     ]
}

Request body consists form a single JSON map contains the following entries:

Entry name Type Mandatory Description
name String Y Name of the databag (must be unique)
tags List of Strings N unlimited, free-named tag assigned to databag
items List of Items N List of (name, value) properties assigned to a databag
templateId String N Optional identifier of a databag template

Delete databag

Path: /rest/databags/(databagId), /rest/projects/(projectId)/databags/(databagId)

Type: DELETE

Example results: The same as with create

Update databag

Path: /rest/databags/(databagId) /rest/projects/(projectId)/databags/(databagId)

Type: PUT

Example results:

Error on update: common result object

Request body:

Input data: The same as with create

Clone this wiki locally