Duplicates a form. The duplicated form, and any subforms, are added to the same folder in the database as the original.
The form's records are not duplicated, only the structure.
Request
POST https://www.activityinfo.org/resources/databases/{databaseId}/forms/{formId}/duplicate
Successful response
application/json
| object | |||
| database | object | required | |
| 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 | |
| id | string | required | |
| name | string | required | |
| string | 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 |
| suspended | boolean | True if this database is suspended for billing reasons | required |
| role | object | The requesting user's assigned role in this database. | required |
| roleId | string | The id of the role assigned to this user. | required |
| roleParameters | object | The values of the parameters defined for this role. | required |
| roleResources | array[string] | The resources (database, folder, forms, or subforms) to which the role's permissions are to apply. | required |
| roles | array[object] | The roles that have been defined for this database. | required |
| id | string | This role's id | required |
| label | string | This role's human-readable label | required |
| permissions | array[object] | Permissions granted this role. Applicable for legacy roles, for grant based roles it will be limited to permissions that are NOT related to resources, like MANAGE_USERS, MANAGE_ROLES |
required |
| operation | string | Values:
|
required |
| filter | string | A formula which restricts a permission to specific records. Only record-level permissions can be filtered. | optional |
| securityCategories | array[string] | required | |
| parameters | array[object] | Parameters defined for this role. Parameters can be referenced in filtering formulas. | required |
| parameterId | string | required | |
| label | string | required | |
| range | string | required | |
| filters | array[object] | Pre-defined filters. Role filters allow other users to choose filters for permissions without having to write formulas themselves. -- NOTEWORTHY - only used by legacy roles | required |
| id | string | This filter's id. | required |
| label | string | This filter's human-readable label | required |
| filter | string | A formula that can be used to filter a record-level permission. | required |
| grants | array[object] | required | |
| resourceId | string | required | |
| operations | array[string] | required | |
| securityCategories | array[object] | The security categories that have been defined for this database. | required |
| id | string | This security category's id | required |
| label | string | This security category's human-readable label | required |
| resources | array[object] | The set of resources (folders, forms, and subforms) that belong to this database. | required |
| id | string | The resource's id. Form and subform resources must have globally-unique ids (across all of ActivityInfo) but folder ids are only guaranteed to be unique within a single database. | required |
| type | string | The resource type. Values:
|
required |
| parentId | string | The id of this resource's parent, for example, a folder id. If this is a top-level folder or form, the the parentId will be the id of the database itself. | required |
| label | string | The resource's human-readable label. | required |
| visibility | string | The resource's visibility. Values:
|
required |
| locks | array[object] | The record locks that have been defined on this database. | required |
| id | string | This lock's id. | required |
| label | string | A human-readable label for this lock | required |
| resourceId | string | The resource (database, folder, form, or subform) to which this lock applies. | required |
| dateRange | object | The date range to which this lock applies. | optional |
| startDate | local_date | required | |
| endDate | local_date | required | |
| formula | string | The formula to which this rule based lock applies. | optional |
| message | string | user description of the rule based lock. | optional |
| deactivated | boolean | required | |
| grants | array[object] | The permission grants that have been made to the requesting user for this database. | required |
| resourceId | string | required | |
| operations | array[string] | required | |
| billingAccountId | integer | required | |
| billingPlan | string | The billing plan name under which this database falls. The billing plan can have an affect on which features are avialable within this database. | required |
| forms | array[object] | required | |
| id | string | The id of the form | required |
| visible | boolean | True if the form is visible to the authenticated user | required |
| deleted | boolean | True if the form has been deleted | required |
| schema | object | required | |
| id | string | The immutable CUID for this form. Must be globally unique within an ActivityInfo server | required |
| label | string | A human-readable label for this form | required |
| schemaVersion | string | A monotonically increasing version number of this schema assigned by the server upon updates | required |
| databaseId | string | The id of the database to which this form belongs | required |
| parentFormId | string | The id of this form's parent, if this form is a subform. Note that subforms can only be created by adding a subform field to the parent form. | optional |
| elements | array[object] | This form's fields, section headers, and other elements. | required |
| id | string | An immutable CUID for this field that is unique within the form | required |
| code | string | A developer-friendly code for this field that can be used in formulas and in the API. Must match the pattern ^[A-Za-z][A-Za-z0-9_]* | optional |
| label | string | A short human-friendly label for this field | required |
| relevanceCondition | string | A boolean-valued ActivityInfo formula that determines when this field is 'relevant'. Fields that are not relevant are not displayed during data entry and must be blank. | optional |
| validationCondition | string | A boolean-valued ActivityInfo formula that determines when this field's value is valid. | optional |
| dataEntryVisible | boolean | If false, this field is not shown in data entry | optional |
| tableVisible | boolean | If false, this field is not shown by default in the table view | optional |
| required | boolean | If true, a value for this field must be provided | required |
| key | boolean | If true, this field is part of the form's natural key fields whose combination must be unique within the form | required |
| type | string | The field type Values:
|
required |
| securityCategoryId | string | optional | |
| typeParameters | object | Additional type-specific properties of this field. | optional |
| units | string | For fields of type 'quantity', describes the units of the quantity | optional |
| inputMask | string | For text fields, provides a pattern-based input mask | optional |
| cardinality | string | For fields of type 'enumerated', indicates whether single or multiple select. Values:
|
optional |
| range | object | For fields of type 'reference', provides the id of the form that this field references | optional |
| formId | string | For fields of type 'subform', provides the id of the sub form that this field references | optional |
| items | array[object] | For fields of type 'enumerated', provided the list of valid choices | optional |
| id | string | The immutable CUID of this selection item. Must match the format [a-z][a-z0-9]{0,25} and be unique within this field. | required |
| label | string | Human-readable label for this selection item. | required |
| formula | string | For fields of type 'calculated', provides the formula for the field's value | optional |
| prefixFormula | string | For fields of type 'serial', provides a formula that will be used to compute the prefix of the generated serial number. | optional |
| permissions | object | required | |
| suspended | boolean | True if the form belongs to a suspended database. | required |
Error responses
| Status Code | Error Code | Description |
|---|---|---|
| 400 | DATABASE_ |
The database could not be found. |
| 400 | FORM_ |
The form to duplicate could not be found. |
| 401 | AUTHENTICATION_ |
The request must be authenticated |
| 403 | PERMISSION_ |
The authenticated user is missing the VIEW permission for the form, or does not have ADD_RESOURCE permission for the form's parent. |
| 403 | SUBFORMS_ |
The authenticated user does not have permission to view all subforms of this forms. |
Example
curl -X POST https://www.activityinfo.org/resources/databases/ck8oykh8m5/forms/ck8pu9ha07/duplicate \
-u anything:APITOKEN