DatabaseΒΆ

GET

Get list of containers

permission: guillotina.GetContainers

http

GET /db HTTP/1.1
Accept: application/json
Host: localhost:8080
Authorization: Basic cm9vdDpyb290

curl

curl -i http://localhost:8080/db -H 'Accept: application/json' --user root:root

httpie

http http://localhost:8080/db Accept:application/json -a root:root

python-requests

requests.get('http://localhost:8080/db', headers={'Accept': 'application/json'}, auth=('root', 'root'))

response

HTTP/1.1 200 OK
Content-Type: application/json
Server: Python/3.6 aiohttp/2.2.5

{
    "@type": "Database",
    "containers": [
        "container"
    ]
}
POST

Create a new Container

permission: guillotina.AddContainer

http

POST /db HTTP/1.1
Accept: application/json
Host: localhost:8080
Content-Type: application/json
Authorization: Basic cm9vdDpyb290

{
    "@type": "Container",
    "id": "container",
    "title": "Container"
}

curl

curl -i -X POST http://localhost:8080/db -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"@type": "Container", "id": "container", "title": "Container"}' --user root:root

httpie

echo '{
  "@type": "Container",
  "id": "container",
  "title": "Container"
}' | http POST http://localhost:8080/db Accept:application/json Content-Type:application/json -a root:root

python-requests

requests.post('http://localhost:8080/db', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'@type': 'Container', 'id': 'container', 'title': 'Container'}, auth=('root', 'root'))

response

HTTP/1.1 401 Unauthorized
Content-Type: application/json
Server: Python/3.6 aiohttp/2.2.5

{
    "error": {
        "message": "Duplicate id",
        "type": "NotAllowed"
    }
}