Forms
Download API definition:
This operation is a Technical Preview and is available for testing purposes only. Do not use in production.
POST https://api.bentley.com/forms/templates/import

Imports a form definition template into your iTwin.

Templates are form definitions from Bentley's publicly available template repository. Importing a template creates a private copy of it in your iTwin that behaves like any other form definition--you can fill out forms from it, or customize it to your organization's needs using the Bentley Form Manager webapp.

Note: If you need to import a form definition from your own organization (including a form definition that your organization imported from a template and then customized), use the Import form definition from another iTwin endpoint instead.

Authentication

Requires Authorization header with valid Bearer token for scope itwin-platform.

For more documentation on authorization and how to get access token visit OAUTH2 Authorization page.

Request headers

Name
Required?
Description
Authorization
Yes

OAuth access token with itwin-platform scope

Accept
Yes

Setting to application/vnd.bentley.itwin-platform.v1+json is recommended.

Request body

Template Import Request

Name
Type
Required?
Description
templateName
String
Yes

The name of the template to import, as retrieved from the Get templates endpoint. Note that templates do not have IDs, so this name is used instead to identify it.

destinationITwinId
String
Yes

The ID of the iTwin to import a copy of the template into.

type
String
No

Sets what form type the imported copy of the template will belong to. This property of the resulting form definition cannot be changed after import.

Template Import Request status
No

Sets what status the imported copy of the template will begin in. Default is 'Approved'.

displayName
String
No

Allows you to set a new display name for the form definition in this iTwin.

idPrefix
String
No

Lets you set a new ID prefix for the form definition in this iTwin.

Example

json
{
    "templateName": "Daily Log",
    "destinationITwinId": "7ac45d38-3a81-4b09-adac-761c2a489c3f",
    "type": "My Daily Log Type",
    "status": "Approved",
    "displayName": "My Daily Log",
    "idPrefix": "123DL"
}

Response 200 OK

The results of the template import request, showing the ID of the newly created form definition.

json
{
    "formDefinition": {
        "id": "e5985Ue5U02hNz19awLcRgpmdeuytxZEhB123456789",
        "displayName": "My Daily Log",
        "type": "My Daily Log Type",
        "status": "Approved",
        "idPrefix": "123DL",
        "errorStatus": "None",
        "_links": {
            "design": {
                "href": "https://connect-formmanager.bentley.com/designer/#/00000000-0000-0000-0000-000000000000/design/11111111-1111-1111-1111-111111111111"
            }
        }
    }
}

Response 401 Unauthorized

This response indicates that request lacks valid authentication credentials. Access token might not been provided, issued by the wrong issuer, does not have required scopes or request headers were malformed.

json
{
    "error": {
        "code": "HeaderNotFound",
        "message": "Header Authorization was not found in the request. Access denied."
    }
}

Response 404 Not Found

Indicates that no template has the given name, or the destination iTwin was not found or inaccessible to the user.

json
{
    "error": {
        "code": "TemplateNotFound",
        "message": "Requested template is not available.",
        "target": "templateName"
    }
}

Response 422 Unprocessable Entity

This response indicates that there is a problem with the request body--either a missing property, invalid property value, or invalid combination of `importAction` and other properties.

json
{
    "error": {
        "code": "InvalidImportRequest",
        "message": "Cannot import form template.",
        "details": [{
            "code": "MissingRequiredProperty",
            "message": "The 'templateName' property must be provided.",
            "target": "templateName"
        }]
    }
}

Response 429 Too many requests

This response indicates that the user has sent too many requests in a given amount of time.

json
{
    "error": {
        "code": "TooManyRequests",
        "message": "More requests were received than the subscription rate-limit allows."
    }
}

Response headers

Name
Description
retry-after

The number of requests exceeds the rate-limit for the client subscription.

Form Definition Summary status

Whether this form definition is available for use. Possible values: Draft or Maintenance means users can edit its layout, but not fill out instances of it. Approved means users can fill it out, but not edit its layout. Archived allows neither.

Name
Type
Description
Draft
String
Approved
String
Maintenance
String
Archived
String

Form Definition Summary shareType

Whether this form definition can be used in multiple iTwins. A value of null means it cannot. 'ReadOnly' and 'ReadWrite' mean it can. 'ReadOnly' means its layout can only be edited from its original iTwin, and 'ReadWrite' means its layout can be edited from any iTwin in the organization.

Name
Type
Description
null
String
ReadOnly
String
ReadWrite
String

Form Definition Summary errorStatus

String describing whether the form definition has problems that could prevent it from displaying (Warning) or functioning (Error or Critical) correctly. Possible values: 'None', 'Warning', 'Error', 'Critical', 'Unknown'.

Name
Type
Description
None
String
Warning
String
Error
String
Critical
String
Unknown
String

Form Definition Summary

Name
Type
Description
id
String

Unique ID for this form definition.

displayName
String

The name of this form definition as it is displayed to users in the Form Manager UI and Forms webapp UI.

type
String

The form type that can be created from this form definition.

Form Definition Summary status

Whether this form definition is available for use. Possible values: Draft or Maintenance means users can edit its layout, but not fill out instances of it. Approved means users can fill it out, but not edit its layout. Archived allows neither.

Form Definition Summary shareType

Whether this form definition can be used in multiple iTwins. A value of null means it cannot. 'ReadOnly' and 'ReadWrite' mean it can. 'ReadOnly' means its layout can only be edited from its original iTwin, and 'ReadWrite' means its layout can be edited from any iTwin in the organization.

idPrefix
String, null

A prefix that appears in front of the auto-incrementing number property of each filled-out instance created from this form definition. Can be null, in which case the system fills in the prefix based on the form's type.

Form Definition Summary errorStatus

String describing whether the form definition has problems that could prevent it from displaying (Warning) or functioning (Error or Critical) correctly. Possible values: 'None', 'Warning', 'Error', 'Critical', 'Unknown'.

Template Import Request status

Sets what status the imported copy of the template will begin in. Default is 'Approved'.

Name
Type
Description
Draft
String
Approved
String
Maintenance
String
Archived
String

Template Import Request

Name
Type
Description
templateName
String

The name of the template to import, as retrieved from the Get templates endpoint. Note that templates do not have IDs, so this name is used instead to identify it.

destinationITwinId
String

The ID of the iTwin to import a copy of the template into.

type
String

Sets what form type the imported copy of the template will belong to. This property of the resulting form definition cannot be changed after import.

Template Import Request status

Sets what status the imported copy of the template will begin in. Default is 'Approved'.

displayName
String

Allows you to set a new display name for the form definition in this iTwin.

idPrefix
String

Lets you set a new ID prefix for the form definition in this iTwin.

Form Definition Import Response

Name
Type
Description

form-definition-design-links

If this form definition is in an editable state and you have permission to edit form definitions, this link sends you to the Form Manager webapp where you can edit its layout. Otherwise, this link will not appear.

Name
Type
Description
design

link

Name
Type
Description
href
String

DetailedError

Contains error information and an array of more specific errors.

Name
Type
Description
code
String

One of a server-defined set of error codes.

message
String

A human-readable representation of the error.

target
String, null

The target of the error.

details

Optional array of more specific errors.

Detailed Error Response

Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.

Name
Type
Description
error

Error Detailed information.

Error

Contains error information.

Name
Type
Description
code
String

One of a server-defined set of error codes.

message
String

A human-readable representation of the error.

target
String, null

The target of the error.

Error Response

Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.

Name
Type
Description
error

Error information.

Was this page helpful?