Adds a new database with a copy of all the forms, folder, and reports in the original database.
Alternatively, when targetDatabaseId is provided, the copied forms and folders are imported into that existing database instead, grouped under a new folder labelled databaseLabel. In this mode, only forms and folders are copied: reports, roles, locks, translations and records are not.
Note that while this Job does support duplicating records, in practice there is limit of 1000 records. Duplicating a database with more than 1000 records and duplicateRecords set to true will fail.
Starting the job
This operation is a long-running batch job. You must first submit a request to start the job.
POST https://www.activityinfo.org/resources/jobs
Request body
| object | |||
| type | string | The type of the job to start. Must be "duplicateDatabase" |
required |
| descriptor | object | required | |
| templateDatabaseId | string | The id of the database to use as a template. | required |
| databaseLabel | string | The label to give the duplicated database, or, when importing into an existing database, the label of the new folder that will contain the imported forms and folders. | required |
| duplicateRecords | boolean | True if records should also be duplicated. | required |
| targetDatabaseId | string | The id of an existing database into which the copied forms and folders should be imported. When absent, a new database is created. | optional |
Getting the job status
The result of this first call provides a job id that you can use to poll for status:
GET https://www.activityinfo.org/resources/jobs/{jobId}
curl -X GET https://www.activityinfo.org/resources/jobs/ahBlfmFjdGl2aXR5aW5mb2V1chALEgNKb2IYgICAzd390wkM \
-u anything:APITOKEN \
-H 'Content-type: application/json' \
--data-binary @- << EOF
{
"id": "ahBlfmFjdGl2aXR5aW5mb2V1chALEgNKb2IYgICAzd390wkM",
"state": "STARTED"
}
EOF
Successful result
When the job state transitions to "COMPLETED", the status object will include the result:
| object | |||
| id | string | The id of the job | required |
| state | string | "COMPLETED" |
required |
| result | object | required | |
| databaseId | string | The id of the new, duplicated database, or, when importing into an existing database, the id of the target database. | required |
| folderId | string | The id of the new folder containing the imported forms and folders, when importing into an existing database. | optional |