Skip to content

Administrative APIs

Joel Christner edited this page Aug 10, 2019 · 1 revision

Less3 provides RESTful APIs for various administrative tasks related to the objects stored in the configuration database (generally named less3.db.

Set the API key header (by default, x-api-key, or the value found in system.json Server.HeaderApiKey) to the admin API key (by default, less3admin, or the value found in system.json Server.AdminApiKey) prior to using these calls.

Administrative API URLs start with /admin/.

Retrieving Objects

Retrieving Buckets

Method URL Description
GET /admin/buckets Retrieve all buckets
GET /admin/buckets/[name] Retrieve bucket by name
GET /admin/buckets
x-api-key: less3admin
Response:
[
  {
    "Id": 1,
    "GUID": "default",
    "OwnerGUID": "default",
    "Name": "default",
    "DatabaseFilename": "./Storage/default/default.db",
    "ObjectsDirectory": "./Storage/default/Objects/",
    "EnableVersioning": false,
    "EnablePublicWrite": false,
    "EnablePublicRead": false,
    "CreatedUtc": "2019-01-01T01:01:01Z"
  }
]
GET /admin/buckets/default
x-api-key: less3admin
Response:
{
  "Id": 1,
  "GUID": "default",
  "OwnerGUID": "default",
  "Name": "default",
  "DatabaseFilename": "./Storage/default/default.db",
  "ObjectsDirectory": "./Storage/default/Objects/",
  "EnableVersioning": false,
  "EnablePublicWrite": false,
  "EnablePublicRead": false,
  "CreatedUtc": "2019-01-01T01:01:01Z"
}

Retrieving Users

Method URL Description
GET /admin/users Retrieve all users
GET /admin/buckets/[name] Retrieve user by name
GET /admin/users
x-api-key: less3admin
Response:
[
  {
    "Id": 1,
    "GUID": "default",
    "Name": "default",
    "Email": "[email protected]"
  }
]
GET /admin/users/default
x-api-key: less3admin
Response:
{
  "Id": 1,
  "GUID": "default",
  "Name": "default",
  "Email": "[email protected]"
}

Retrieving Credentials

Method URL Description
GET /admin/credentials Retrieve all credentials
GET /admin/credentials/[accesskey] Retrieve credential by access key
GET /admin/credentials
x-api-key: less3admin
Response:
[
  {
    "Id": 1,
    "GUID": "default",
    "UserGUID": "default",
    "AccessKey": "default",
    "SecretKey": "default"
  } 
]
GET /admin/credentials/default
x-api-key: less3admin
Response:
{
  "Id": 1,
  "GUID": "default",
  "UserGUID": "default",
  "AccessKey": "default",
  "SecretKey": "default"
}

Creating Objects

Objects can be created by calling POST /admin/[resourcetype]. Pass in an object using the structure described above. You can exclude the Id key from the object.

Method URL Description
POST /admin/buckets Create a bucket
POST /admin/credentials Create a credential
POST /admin/users Create a user

Deleting Objects

Objects can be deleted by calling POST /admin/[resourcetype]/[identifier]. The identifier is based on the value used in the URL when retrieving the object as described above.

Method URL Description
DELETE /admin/buckets/[name] Delete a bucket by its name
DELETE /admin/credentials/[accesskey] Delete a credential by its access key
DELETE /admin/users/[name] Delete a user by name
Clone this wiki locally