Add database

Adds a new database. The authenticated user will be the database owner.

Only users who have a billing account with ActivityInfo are permitted to add new databases.

Request

POST https://www.activityinfo.org/resources/databases

Request body

application/json

object
id string The id of the new database. required
label string Human readable name of the database. required
templateId string The id of the template to use in creating the new database. The the two templates currently supported are "reporting" (Multi-partner reporting) and "casemanagement." If ommitted, a blank database with three simple roles will be added. required
description string An optional, longer description for the database. optional

Successful response

application/json

object
databaseId string This database's id required
userId string The id of the requesting user. The contents of the tree depends on the permissions of the requesting user. optional
version string The monotonically-increasing version of the database tree. The version number is incremented whenever a change is made that affects the database tree. required
label string This database's human-readable label. required
description string required
ownerRef object required
language string Current database language required
originalLanguage string Original database language optional
languages array[string] The languages that have been defined for this database translation. required
continuousTranslation boolean True if the database continuous automatic translation is enabled required
translationFromDbMemory boolean True if automatic translation from database memory is allowed for the database required
thirdPartyTranslation boolean True if third-party translation is allowed for the database required
suspended boolean True if this database is suspended for billing reasons required
role object The requesting user's assigned role in this database. required
roles array[object] The roles that have been defined for this database. required
securityCategories array[object] The security categories that have been defined for this database. required
resources array[object] The set of resources (folders, forms, and subforms) that belong to this database. required
locks array[object] The record locks that have been defined on this database. required
grants array[object] The permission grants that have been made to the requesting user for this database. required
billingAccountId integer required

Error responses

Status Code Error Code Description
400 BILLING_ACCOUNT_NOT_ACTIVE The authenticated user's billing account is not active.
400 NO_BILLING_ACCOUNT The authenticated user has no billing account, and so cannot add a database.
401 AUTHENTICATION_REQUIRED The request must be authenticated
409 DATABASE_EXISTS A database with this id already exists.

Example

curl -X POST https://www.activityinfo.org/resources/databases \
  -u anything:APITOKEN \
  -H 'Content-type: application/json' \
  --data-binary @- << EOF
{
  "id": "ck8oykh8m5",
  "label": "My new database",
  "templateId": "",
  "description": null
}
EOF

The above command returns JSON structured like this:

{
  "databaseId": "ck8oykh8m5",
  "userId": "",
  "version": "0",
  "label": "",
  "description": "",
  "ownerRef": {
    "id": "",
    "name": "",
    "email": ""
  },
  "billingAccountId": 0,
  "language": "",
  "originalLanguage": "",
  "continuousTranslation": false,
  "translationFromDbMemory": false,
  "thirdPartyTranslation": false,
  "role": {
    "id": "default",
    "parameters": {
      
    }
  },
  "suspended": false,
  "storage": "",
  "publishedTemplate": false,
  "roles": [
    {
      "id": "admin",
      "label": "Administrator",
      "permissions": [
        {
          "operation": "VIEW"
        },
        {
          "operation": "ADD_RECORD"
        },
        {
          "operation": "EDIT_RECORD",
          "securityCategories": [
            "reviewer"
          ]
        },
        {
          "operation": "MANAGE_REFERENCE_DATA"
        },
        {
          "operation": "DELETE_RECORD"
        },
        {
          "operation": "BULK_DELETE"
        },
        {
          "operation": "EXPORT_RECORDS"
        },
        {
          "operation": "MANAGE_USERS"
        },
        {
          "operation": "LOCK_RECORDS"
        },
        {
          "operation": "ADD_RESOURCE"
        },
        {
          "operation": "EDIT_RESOURCE"
        },
        {
          "operation": "DELETE_RESOURCE"
        },
        {
          "operation": "MANAGE_COLLECTION_LINKS"
        },
        {
          "operation": "AUDIT"
        },
        {
          "operation": "SHARE_REPORTS"
        },
        {
          "operation": "PUBLISH_REPORTS"
        },
        {
          "operation": "MANAGE_ROLES"
        },
        {
          "operation": "MANAGE_TRANSLATIONS"
        }
      ],
      "version": 0,
      "grantBased": false
    },
    {
      "id": "readonly",
      "label": "Read only",
      "permissions": [
        {
          "operation": "VIEW"
        }
      ],
      "version": 0,
      "grantBased": false
    },
    {
      "id": "dataentry",
      "label": "Data Entry",
      "permissions": [
        {
          "operation": "VIEW"
        },
        {
          "operation": "EDIT_RECORD"
        },
        {
          "operation": "ADD_RECORD"
        },
        {
          "operation": "DELETE_RECORD"
        },
        {
          "operation": "EXPORT_RECORDS"
        }
      ],
      "version": 0,
      "grantBased": false
    }
  ]
}
Next item
Add database user