Contract Express v9 - API Manual
Contract Express v9 - API Manual
Disclaimer
This manual as well as the software described in it, is furnished under license and may be used or copied only in accordance with the terms
of such a license. The content of this document is furnished for informational use only, is subject to change without notice and does not
represent a commitment on the part of Thomson Reuters. Thomson Reuters assumes no responsibility or liability for any errors or
inaccuracies that may appear in this manual.
All rights reserved. Except as permitted by such license, this manual may not be copied, photocopied, reproduced, translated or converted
to any electronic or machine-readable form in whole or in part without the prior written approval of Thomson Reuters.
Trademarks
Contract Express, Contract Express for SharePoint, Contract Express for Salesforce, Contract Express Author, Contract Express Drafter,
Contract Express DealBuilder, Contract Express Administrator, ContractExpress.com, Contract Express Cloud, Contract Express for
SharePoint Cloud, Contract Express QuickStart, and the Contract Express system are trademarks of Thomson Reuters. All other brand or
product names are trademarks or registered trademarks of their respective owners.
Contents
1. Introduction ........................................................................................................................................................6
2. Getting started with the API ...............................................................................................................................7
2.1 Suggested Approach ...................................................................................................................................7
2.2 Postman Overview .....................................................................................................................................7
2.3 Before using Postman – Create an API client in Contract Express .............................................................7
2.4 Contract Express API Quickstart .................................................................................................................9
2.5 Contract Express Integration Sample/Sample App ....................................................................................9
2.6 Other considerations for accessing the Questionnaire ..............................................................................9
3. Security ............................................................................................................................................................ 10
3.1 Authentication & Authorization .............................................................................................................. 10
3.1.1 Authorization Code grant type for obtaining an Access Token ............................................................... 10
3.1.2 Implicit grant type for obtaining an access token ................................................................................... 13
3.1.3 Validating the identity token ................................................................................................................... 15
3.1.4 Refresh tokens ......................................................................................................................................... 15
3.1.5 Context .................................................................................................................................................... 15
4. API Reference .................................................................................................................................................. 17
4.1 Requests .................................................................................................................................................. 18
4.2 Entities ................................................................................................................................................... 112
5. Embedding the Questionnaire ...................................................................................................................... 155
5.1 Launching a Questionnaire .................................................................................................................... 155
5.1.1 URL Name=Value Parameters ............................................................................................................... 155
5.1.2 Target Window ...................................................................................................................................... 157
5.1.3 Target <IFRAME> ................................................................................................................................... 157
5.2 Designing a Custom Questionnaire Layout ........................................................................................... 161
5.2.1 Nelson Layout ........................................................................................................................................ 163
5.2.2 Building a Skeleton ................................................................................................................................ 163
5.2.3 Building the Alerts ................................................................................................................................. 166
5.2.4 Building the Questionnaire.................................................................................................................... 166
5.2.5 Building a Repetition Grid ..................................................................................................................... 170
4 Contract Express® API Manual
17 November 2022
5 Contract Express® API Manual
Revision Notes
Revision Date Comments
9.0 17 November 2022 Irrelevant content removed, version number changed, and formatting updated.
8.10.0 01 March 2022 Version number changed and formatting updated.
8.9 01 Sept 2021 Version number changed and Postman/Quickstart details updated.
8.8.0 01 February 2021 Version number changed.
8.7.0 01 July 2020 Version number changed.
8.6.0 11 March 2020 Version number changed.
8.5.0 12 September 2019 Version number changed and formatting amended.
8.1.1 4 June 2019 Formatting corrected.
8.1.0 25 April 2019 Version number changed.
8.0.0 5 February 2019 Postman example updated.
7.3.2 4 June 2018 Formatting corrected.
7.3.1 25 May 2018 Irrelevant content removed.
7.3.0 15 January 2018 Postman section updated and minor changes made to correct typing mistakes.
7.2.0 02 August 2017 Revised Section 2.
7.1.0 02 February 2017 Updated Authentication and Getting Started with the API using Postman section to
cover more of the available flows for obtaining an access token.
7.0.0 05 September 2016 Updated Authentication and Getting Started with API using Postman
(authorization code flow).
6.0.0 20 May 2016 Updated Authentication and Getting Started with API using Postman.
6.0.0 30 November 2015 Added document version API calls.
5.4.0 24 April 2015 Added Getting Started with API using Postman.
5.4.0 20 April 2015 Updated for 5.4 release.
5.2.4 9 January 2015 Correct minor typographical errors.
5.2.3 5 January 2015 Corrected message details in 5.1.3.
5.2.2 14 May 2014 Added document upload.
5.2.1 30 April 2014 Published.
5.2.0 21 April 2014 First draft.
6 Contract Express® API Manual
1. Introduction
This document describes the Contract Express Application Programming Interface (API) and is intended to help
programmers to develop client applications that can make use of the resources managed by an instance of
Contract Express. The main resource of business interest is likely to be a Contract, expressed as a set of
Documents generated from some Templates. What follows is a description of Templates, Contracts and
Documents, and how a client application can manipulate them via the Contract Express services.
The API is designed in a RESTful style. Central to this approach is the use of a "uniform interface" based on four
guiding principles:
1. Identification of resources. For example, using URIs. The resources themselves are conceptually
separate from the representation used to return them to the client. Resources are usually collections of
items of the same type, and there is a way to address both the collection and individual items in that
collection.
2. Manipulation of a resource. The representation of a resource returned to the client is enough for it to
modify or delete the resource.
3. Self-descriptive responses. Each request or response should include enough information to describe
how to process the message. For example, identifying the content-type formatter required to parse the
message.
4. Hypermedia as the engine of application state. Clients make state transitions through actions that are
dynamically identified within a response (e.g., links). Except for simple fixed entry points to the
application, a client should not assume that any particular action is available for any resource beyond
those described in representations previously received from the server.
• The first uses Postman to show how to get started with the API.
• The second describes how to access the API when it has been secured using one of several supported
mechanisms.
• The third is the API Reference section, detailing the requests that can be made to the API.
• Finally, we look at how to incorporate the questionnaire into the user interface of a host system and
customize it so that it adopts the "look and feel" of the host.
17 November 2022
Getting started with the API 7
For testing purposes, we suggest that an API client is created through the Contract Express UI, as outlined in the
Before using Postman section. For production purposes, you may use this approach; alternatively, if you have an
on-premises instance of Contract Express, you may create a client within the Contract Express backend
configuration as outlined in the Security section. Both approaches are equally valid, and the resultant client
behaves in the same way. Authorization is achieved using this client with one of the OpenID Connect or OAuth2
supported flows; these are also outlined in this section.
On successful authorization, the Contract Express Identity Server issues an access token; this is then used to
make API calls for the lifetime of the token; after this a new one must be acquired. A new token may be
acquired either by going through the authorization process again or by using a valid refresh token. We start with
our suggested approach, continue with details of how to use Postman to test the API, and finish with a brief
discussion of our sample application and other considerations for accessing the questionnaire.
If you require behaviour not covered in the Quickstart, we suggest that you experiment in the Contract Express
UI using your browser’s integrated developer tools (F12 or Ctrl+Shift+I in most browsers) to determine which API
calls are required for the desired behaviour. Alternatively, you may consult the API reference section of the
manual. Once you have found the calls you require, we suggest that they are added to your Quickstart collection
to experiment further. Additionally, you may wish to experiment with our sample application to see what a
typical integration might look like. To obtain a copy of the sample application, please see our Contract Express
Knowledge Base.
If you do not have Postman, you can download it from here. It is worth consulting the documentation if you are
not familiar with Postman, the introduction can be accessed here.
To make any calls to the Contract Express API, you will need to create an API client within the Contract Express
Admin section. Additionally, you will need to know your authorization and token URLs – these can be found by
browsing to your OpenID configuration endpoint (https://myhost.mydomain.com/id/core/.well-known/openid-
configuration OR https://myhost.mydomain.com/IdServ/core/.well-known/openid-configuration.
17 November 2022
8 Contract Express® API Manual
5. Fill in the details. Your client’s name and ID must be unique. For Postman, the Redirect URI should be
https://www.getpostman.com/oauth2/callback.
6. Make a note of your client ID and Secret - you will need them when you configure the Quickstart.
17 November 2022
Getting started with the API 9
The Contract Express API Quickstart is a Postman exercise that uses real examples, using the most common
requests, to introduce you to Contract Express’ API. The preconfigured collection includes numerous requests
including how to:
To obtain a copy of the API Quickstart, please see our Contract Express Knowledge Base under the
“Documentation and Resources” section. Within the package, you will also find our quick guide “Getting started
with Contract Express API using Postman” which will provide a more detailed walkthrough on how to setup the
Postman environment. Both the collection and environment are provided as supplements to the Quickstart and
may be imported into Postman.
To configure the Quickstart, you will also need your Contract Express authorization and token URLs. You may
obtain these from your Contract Express OpenID endpoint - [Contract Express URL]/id/core/.well-known/openid-
configuration or depending on your application directory, it may be [Contract Express URL]/IdServ/core/.well-
known/openid-configuration - for example: https://eu1.contractexpress.com/IdServ/core/.well-known/openid-
configuration
The Contract Express sample application demonstrates a typical, simple integration with Contract Express
including how Authentication and Embedding the Questionnaire work. To obtain a copy of the sample
application, please see our Contract Express Knowledge Base under the “Documentation and Resources”
section.
The examples above aim to help familiarize you with the Template API. However, there are other aspects related
to accessing the questionnaire in an external application that must be considered. For example, they do not cover
the Contract resource in any way. The Contract resource is the key transactional item that contains the answers
from a user interacting with the questionnaire and the documents that are produced from that answer set. This
is described in more detail in the API reference section.
Although every request to the API is authenticated using the access token described above, there are several ways
to obtain the access token depending on how Contract Express Identity Server has been configured and how the
client application access has been configured. For example, the OAuth Authorization Code flow was used above,
but the Implicit flow can also be used. Also, Identity Server can support various authentication mechanisms, such
as username and password, Windows authentication, ADFS and others.
17 November 2022
10 Contract Express® API Manual
3. Security
Any description of security must address two basic questions: who are you? (Authentication) and what are you
allowed to do? (Authorization).
Most of the Contract Express API calls access protected resources which require authorization. Therefore, a
client application needs to be authorized by an existing Contract Express user to make calls on their behalf and
gain access to the protected resource targeted by the call.
To obtain authorization, the application MUST request an access token from the Security Token Service (STS)
hosted in the Contract Express Identity Server web application. The STS implements the OpenID Connect and
OAuth 2.0 protocols for authentication and authorization purposes. The STS also offers support for multiple
authorization grant types and authentication flows. While multiple authentication mechanisms are supported
(Local login/Forms based authentication) and using external identity providers (Windows integrated or ADFS)
not all are suitable for certain authorization grant flows.
After the user’s successful authentication and the completion of the authorization flow, the Contract Express
Identity Server will issue an access token. Contract Express will use the access token to construct a set of
application specific “claims”, such as: The user is Ted, he is in the Thomson Reuters license space, he has the role
of template author, and he is a member of the “Development” and “UK” groups - these claims are used to make
decisions regarding authorization, which we also discuss below.
17 November 2022
Security 11
17 November 2022
12 Contract Express® API Manual
If the authorize request is valid, the Contract Express login page will be displayed, and the user can authenticate.
After successfully authenticating, an authorization code will be generated and sent to the client application as a
URL fragment (or as a form_post).
The callback endpoint in the client application should extract the code received in the response from the
Identity Server and make a POST request to the token endpoint (example:
https://myhost.mydomain.com/id/core/connect/token) to exchange it for an access token. If the state
parameter was set in the authorize request, it should be validated before attempting to extract the
authorization code.
The POST request to the token endpoint requires authentication. Authentication is handled by passing the client
id and secret pair as fields in the body (client_id=<client_id value>, client_secret=<client_secret value>) or in
the Authorization header using Basic authentication. If using the Basic authentication method, the value of the
header is expected to be (Basic <Base64 encoded string> where <Base64 encoded string> is: <client_id
value>:<client_secret value> Base64 encoded.
17 November 2022
Security 13
The request must also contain the following key value pairs in the body:
- grant_type=authorization_code
If the call to the token endpoint was successful, an access token should be included in the response. The
response might also include an id token and/or a refresh token (if the openid and/or offline_access scopes were
added in the authorize request). The access_token is stored by the client application and is used when making
API calls that require authorization.
3.2.2.1 Registering an Implicit grant type client with the Contract Express Identity Server
This section applies to on-premises deployments of Contract Express; the registration of a new client is done by
adding a new client element to the “CEClientsConfig.xml” file located in the “Content” folder where Contract
Express is deployed (example: C:\inetpub\wwwroot\id (or IdServ)\Content).
17 November 2022
14 Contract Express® API Manual
If the authorize request is valid the Contract Express login page will be displayed, and the user can authenticate.
After successfully authenticating an access token will be generated and sent to the client application as a URL
fragment.
The callback endpoint in the client application should extract the access token from the Identity Server response
and validate the id_token and the nonce found inside it. If the state parameter was set in the authorize request
it should be validated before attempting to extract the authorization code.
The access_token is stored by the client application and is used when making API calls that require
authorization.
17 November 2022
Security 15
To validate the token with the Identity Server, a POST request is made to the validation endpoint - example:
https://myhost.mydomain.com/id/core/connect/identitytokenvalidation with the following key value pairs in
the body:
On a successful validation a 200 response with token’s associated claims will be returned. For details about
validating the token in the client application, please consult the sample application and the OpenID Connect
spec.
The POST request to the token endpoint requires authentication. Authentication is handled in the same way as
described in section 3.2.2.2.
The request must also contain the following key value pairs in the body:
• grant_type=refresh_token
• refresh_token = <refresh_token value>
If the call to the token endpoint was successful, an access token should be included in the response.
3.1.5 Context
While the access token obtained from the previous steps confirms that the user authorized the client application
to make requests in their name, it does not guarantee that it will be able to access the resource. Contract
Express needs to confirm that the user is allowed access to that resource through its own authorization
mechanism.
There are two levels to authorization: Firstly, general authorization for actions on a class of object, such as
"Authors are allowed to manage templates", and secondly permission on a particular object, such as "Ted is
allowed to read contract number 42".
Consider first the statement “Authors are allowed to manage templates”. This type of rule describes a general
“authority” and is specified in terms of an “action” on a “resource” being allowed if some condition on “claims”
is true. So, in the example above the resource is “templates”, the action is “manage” and the test is
17 November 2022
16 Contract Express® API Manual
“role=author”. The set of all such rules is called a policy and is defined in the web.config file; therefore, it is per
Contract Express instance, not per license space, and our cloud users cannot configure this policy for
themselves. Each API method has an associated set of Action/Resource pairs, as described in the Reference
section. If the policy does not grant them all to the current user, then the call to that API method is rejected as
“Forbidden”. The Action/Resource pairs are also used to adapt the user interface, so that for example certain
tabs in the admin page are only offered if the current user has “Manage/Licence” authority.
Some authorization demands vary according to the state of the object being used. So, for example using a
template normally requires Use/Templates authority, but if the template in question has the property IsMajor
set to false, then using the template requires Test/Template authority.
Now consider the statement “User Ted is allowed to read contract number 42”. This type of rule describes
permission on a particular securable object and is called an “access control rule”. There are currently five
categories of securable object in the system: Templates, Contracts, Folders, Approvals and External Tables.
Access to any particular instance of any of those types is controlled by an Access Control List (ACL) which is an
ordered list of access control rules. Each rule specifies a permission (None, Read, Write or Full) based on a claim
having a particular value. So, in the example above the ACL on contract 42 will contain the rule stating, “grant
Read permission if the ‘userid’ claim has the value ‘Ted’”. Where an ACL has multiple rules, the effective
permission is determined by the first rule that matches the user’s claims. So, if there was a later rule in the ACL
on contract 42 that stated, “Group UK has permission None”, Ted would still get access even though he is in the
UK group because the user specific rule was earlier in the list and matched his claims. Every single ACL has an
implied first rule that states “grant full permission if role is admin”. The ACL for an object can be modified by
anyone who has "Full" permission. Typically, things for which the current user has effective permission of
“None” are not returned in queries and give a “Not found” response in instance specific actions; it is as if they
don’t exist for that user.
17 November 2022
API Reference 17
4. API Reference
This section of the manual consists of two parts. Firstly, the requests used to manipulate the resources. Some of
these require structured data in the request or return structured data in the response. This structured data, which
we call Entities, are described in the second part.
Each request is described in terms of the URI identifying the resource and the HTTP method used. Then there is a
description of each parameter used in the request, and the data returned in the response. We also describe the
authorization required to perform the action. Each action also has an example invocation using the "curl" tool
described here http://en.wikipedia.org/wiki/CURL.
Some resources, such as templates, are identified by string values. Such values are subject to certain constraints.
They may not contain the characters '<', '>', '*', '%', '&', ':', '\', '/', '#', or '?' and may not
have '.' as the last non-whitespace character.
The API is tightly coupled to the HTTP protocol and makes systematic use of the standard HTTP methods.
Resource Method
GET PUT POST DELETE
Collection, for example List the URIs and Replace the Create a new Delete the entire
api/templates perhaps other entire collection entry in the collection.
details of the with another collection. The
collection's collection. new entry's URI is
members. assigned
automatically and
is usually
returned by the
operation.
Item, for example Retrieve a Replace the Perform some Delete the
api/templates/MyTemplate representation of addressed action on the addressed
the addressed member of the addressed member of the
member of the collection, or if it member of the collection.
collection. doesn't exist, collection.
create it.
In one case the OPTIONS method is used on a resource to test the current user's authorization without incurring
the overhead of retrieving a representation of that resource.
17 November 2022
18 Contract Express® API Manual
4.1 Requests
A client performs some operation on the resources managed by the API by submitting HTTP requests, where the
URL path identifies a resource or collection of resources, and the HTTP method might distinguish certain actions
on that resource. The table below gives a summary of the main resources, and the following pages then give
details about each action on that resource.
Resource Comment
/api Main entry point to API, links to resource
collections.
/api/upload/templates Upload a docx file, to be used as a template.
/api/templates Collection of templates accessible to current
user.
/api/templates/{reference} A specific template.
/api/templates/{reference}/acl The access control list for the template.
/api/templates/{reference}/dictionary The current local dictionary of the specified
template.
/api/templates/{reference}/versions All versions of the specified template.
/api/templates/{reference}/versions/{version} A specific template version.
/api/templates/{reference}/versions/{version}/content The docx template file that was last uploaded
for this template version.
/api/templates/{reference}/versions/{version}/subtemplates The sub templates used by this template
version.
/api/templates/{reference}/approvalsteps The steps of the approval process for this
template.
/api/templates/{reference}/approvalsteps/{title} An individual step in the approval process for
this template.
/api/templates/{reference}/history The history of events relating to the
template.
/api/contracts Collection of contracts accessible to current
user.
/api/contracts/{id} A specific contract.
/api/contracts/{id}/acl The access control list for the specified
contract.
/api/contracts/{id}/answers The current answer set for the specified
contract.
/api/contracts/{id}/questionnaire/pages/{page} A questionnaire page for the specified
contract.
17 November 2022
API Reference 19
Resource Comment
/api/contracts/{id}/documents The documents for the contract, based on
current answers.
/api/contracts/{id}/documents/zip Download all documents as a single zip file.
/api/contracts/{id}/documents/{docid} The meta data for the specified document.
/api/contracts/{id}/documents/{docid}/content The content byte stream for the specified
document.
/api/upload/documents/{docid} Upload an edited version of a generated
document.
/api/contracts /{id}/inputdocuments External documents uploaded for a contract.
/api/contracts /{id}/invitations Invitations to collaborate on a contract.
/api/contracts/{id}/snapshot A zip file allowing reconstruction of the
contract in its current state (debug).
/api/contracts/{id}/templates The templates that are used for attachments
for this contract (preview).
/api/contracts/{id}/templates/{template}/wording The consolidated wording for the specified
template used by the contract (preview).
/api/contracts/{id}/approvals The approvals relating to a contract.
/api/approvals The approvals awaiting approval.
/api/folders Collection of root folders accessible to the
current user.
/api/folders/{id} A specific folder.
/api/folders/{id}/acl The access control list for the specified
folder.
/api/folders/{id}/contracts The contracts in this folder.
17 November 2022
20 Contract Express® API Manual
/api
Method: GET
Parameters:
None
Response:
Authorization:
Unauthenticated.
Remarks:
The EntryPoint entity is the root of the API installed on the site. It indicates the version number and gives links to
the primary collections of resources, such as Templates and Contracts. It also contains assertions about copyright,
trademarks, and patents. This is the only resource that permits unauthenticated access.
Example:
curl
17 November 2022
API Reference 21
/api/upload/templates
Method: POST
Parameters:
Response:
The request content can either be the byte stream of the DOCX file that is the template, or it can be structured as
a multi-part MIME with the single part being the DOCX file. The response is a TemplateVersion entity, with a
content type of application/json or application/xml.
Authorization:
Requires Manage/Templates authority. If the template already exists then it requires Write permission on the
template, otherwise for a new template the user is automatically granted Full permission.
Remarks:
The template document is validated on upload, and is rejected if it is not a valid DOCX file, or it does not have a
custom property named db_template_reference whose value is a valid string identifier, or the mark-up in the
document is not well formed. Further if the template version already exists then it will be overwritten unless the
Major flag is true in which case the upload is rejected.
Example:
17 November 2022
22 Contract Express® API Manual
/api/templates
Method: GET
Parameters:
Response:
Returns a Template entity list, with no child entities pre-populated and no links. The Content-type is either
application/json or application/xml.
Authorization:
The response will only contain templates for which the current user has at least Read permission. Use/Templates
and Use/Queries authority is required.
Remarks:
When 'manage' is true and the user has Manage/Templates authority then the response contains details of the
current version, irrespective of whether it is a major or minor version. It also returns template details where there
are no active versions if the user has Write permission on that template. When 'manage' is false the response will
only contain information about the current Major version.
Example:
curl https://myhost.mydomain.com/rest/api/templates?manage=true
17 November 2022
API Reference 23
/api/templates/{reference}
Method: GET
Parameters:
Response:
A Template entity with none of the current version properties instantiated, nor any child objects. It will have a
Link for creating a new contract from this template. The content-type can be application/json or application/xml.
Authorization:
Remarks:
Retrieves a specific Template entity. The reference must be a valid string identifier.
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate
17 November 2022
24 Contract Express® API Manual
/api/templates/{reference}
Method: POST
Parameters:
Response:
No content.
Authorization:
Remarks:
Note that the template itself must permit Guest access, and there must be a current Major version, as well as the
Advertise property to be true, for a template to be shown on the public page. The reference must be a valid string
identifier.
Example:
17 November 2022
API Reference 25
/api/templates/{reference}
Method: POST
Parameters:
Response:
No content.
Authorization:
Remarks:
This will restore the most recently uploaded version of the template if it has been deleted (made inactive). The
reference must be a valid string identifier.
Example:
17 November 2022
26 Contract Express® API Manual
/api/templates/{reference}
Method: DELETE
Parameters:
Response:
No content.
Authorization:
Remarks:
The reference must be a valid string identifier. The template and all its versions will be deleted. Note this will mean
that any contracts based on the template will no longer be able to display the questionnaire, or regenerate
documents.
Example:
17 November 2022
API Reference 27
/api/templates/{reference}/acl
Method: GET
Parameters:
Response:
Returns the ACL for the specified template with content-type application/json or application/xml.
Authorization:
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/acl
17 November 2022
28 Contract Express® API Manual
/api/templates/{reference}/acl
Method: PUT
Parameters:
Response:
No content.
Authorization:
Remarks:
Set the ACL on the template. An ACL is an ordered list of AccessControlRule entities.
Example:
17 November 2022
API Reference 29
/api/templates/{reference}/dictionary
Method: GET
Parameters:
Response:
The dictionary of the specified template, content-type application/xml. An Etag header is also returned that can
be used for the fulfilment of subsequent requests from the client cache.
Authorization:
Remarks:
Retrieves either the local (unconsolidated) Dictionary for the current version of the specified template, or the fully
consolidated Dictionary for the template and all its descendant sub-templates. This supports the sharing of
dictionary objects across templates while they are being prepared in the Author tool, or for various other
integration scenarios. The dictionary is only available as XML.
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/dictionary
17 November 2022
30 Contract Express® API Manual
/api/templates/{reference}/versions
Method: GET
Parameters:
Response:
A list of TemplateVersion entities for the specified template. The content-type can be application/json or
application/xml.
Authorization:
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/versions
17 November 2022
API Reference 31
/api/templates/{reference}/versions/{version}
Method: GET
Parameters:
Response:
The TemplateVersion entity for the specified version of a template. The content-type can be application/json or
application/xml.
Authorization:
Remarks:
The reference and version must be valid string identifiers. Note that IIS by default routes a URL where the last
path segment contains a '.' character, to the static file handler. It is possible to configure IIS to not do this, but that
has a performance impact. An alternative is to provide a trailing slash to the URL, so that the version number is
not the last segment.
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/versions/1.0/
17 November 2022
32 Contract Express® API Manual
/api/templates/{reference}/versions/{version}
Method: PUT
Parameters:
Response:
The updated TemplateVersion entity for the specified version of a template. The content-type can be
application/json or application/xml.
Authorization:
Remarks:
The reference and version must be valid string identifiers. This method can be used to update the Name,
Description, Keywords, NettPrice, IsInactive and IsMajor properties of the TemplateVersion entity.
Example:
17 November 2022
API Reference 33
/api/templates/{reference}/versions/{version}
Method: DELETE
Parameters:
Response:
No content.
Authorization:
Remarks:
Example:
17 November 2022
34 Contract Express® API Manual
/api/templates/{reference}/versions/{version}/dictionary
Method: GET
Parameters:
Response:
The dictionary of the specified template, content-type application/xml. An Etag header is also returned that can
be used for the fulfilment of subsequent requests from the client cache.
Authorization:
Remarks:
Retrieves the local (unconsolidated) Dictionary for the specified version of the template. This supports the sharing
of dictionary objects across templates while they are being prepared in the Author tool. The dictionary is only
available as XML.
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyContract/versions/1.0/dictionary
17 November 2022
API Reference 35
/api/templates/{reference}/versions/{version}/content
Method: GET
Parameters:
Response:
Authorization:
Remarks:
The byte stream will be identical to that of the DOCX file that was uploaded. Write permission is required rather
than Read, even though the content is just being downloaded, because we want to restrict access to the source
of a template to only those who have been granted permission to update it.
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/versions/1.0/content
17 November 2022
36 Contract Express® API Manual
/api/templates/{reference}/versions/{version}/subtemplates
Method: GET
Parameters:
Response:
Authorization:
Remarks:
The list will contain all the sub-templates referenced by the specified version of the parent template and which
are accessible under the claims of the user who uploaded that version. The TemplateVersion entities in the list
will be determined by the 'minor' flag, and then by a suitable moment in time. If the minor is true then the ValidTo
date of the parent template is used, otherwise the MajorValidTo date is used. If that value is null, then the current
date and time is used. The sub-template versions in the list will all be valid at that moment. Note that this query
will even return an entity for a sub-template for which this user has an effective right of None.
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/versions/1.0/subtemplates?minor=true
17 November 2022
API Reference 37
/api/templates/{reference}/approvalsteps
Method: GET
Parameters:
Response:
A list of ApprovalStep entities for the specified template. The content-type can be application/json or
application/xml.
Authorization:
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/approvalsteps
17 November 2022
38 Contract Express® API Manual
/api/templates/{reference}/approvalsteps
Method: POST
Parameters:
Response:
The fully instantiated ApprovalStep entity for the added step. The content-type can be application/json or
application/xml.
Authorization:
Remarks:
Example:
17 November 2022
API Reference 39
/api/templates/{reference}/approvalsteps/{title}
Method: GET
Parameters:
Response:
The ApprovalStep entity for the specified step of the specified template. The content-type can be application/json
or application/xml.
Authorization:
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/approvalsteps/Legal
17 November 2022
40 Contract Express® API Manual
/api/templates/{reference}/approvalsteps/{title}
Method: PUT
Parameters:
Response:
The fully updated ApprovalStep entity for the specified step of the specified template. The content-type can be
application/json or application/xml.
Authorization:
Remarks:
The reference and title must both be valid string identifiers. Only updateable fields of the ApprovalStep will be
updated. Some dependent fields will also be updated in the response, such as ModifiedBy.
Example:
17 November 2022
API Reference 41
/api/templates/{reference}/approvalsteps/{title}
Method: DELETE
Parameters:
Response:
No content.
Authorization:
Remarks:
Deletes the specified ApprovalStep object. The reference and title must both be valid string identifiers.
Example:
17 November 2022
42 Contract Express® API Manual
/api/templates/{reference}/history
Method: GET
Parameters:
Response:
A list of SystemHistory entities for the specified template. The content-type can be application/json or
application/xml.
Authorization:
Remarks:
Returns a history of events that relate to the specified Template, with the most recent first. The reference must
be a valid string identifier. Certain events with the System property set to true will only be included in the result
if the user has Full permission on the Template.
Example:
curl https://myhost.mydomain.com/rest/api/templates/MyTemplate/history
17 November 2022
API Reference 43
/api/contracts
Method: POST
Parameters:
Response:
Contract entity, with no child entities pre-populated. Links to self, questionnaire, answers, documents, template
and containing folder. The Content-type is either application/json or application/xml.
Authorization:
When 'minor' is false then requires Read permission on template, and Use/Contracts and Use/Templates
authority. When 'minor' is true then requires Write permission on template and Use/Contracts and
Test/Templates authority.
Remarks:
This creates a new contract in the user's home folder. Permission inherits from that containing folder. The identity
claims of the user who uploaded the template version are used for determining authorization on sub-templates.
Example:
17 November 2022
44 Contract Express® API Manual
/api/contracts
Method: GET
Parameters:
Response:
Contract entity list, with no child entities pre-populated and no links. The Content-type is either application/json
or application/xml.
Authorization:
The response will only contain contracts for which the current user has at least Read permission. Use/Contracts
and Use/Queries authority is required.
17 November 2022
API Reference 45
Remarks:
When 'direct' is true then the response only contains contracts for which the user has at least Read permission
but No permission on the contract's containing folder.
The underlying query is restricted to the most recently created 1024 contracts after applying permission and
'direct' constraints, but before the applying the OData constraints.
Please note we have different parameters for filtering/sorting metadata columns as opposed to template specific
data. Sorting/Filtering on metadata columns use the standard OData query string parameters listed in the table
above (prefixed by the $). For sorting/filtering on template specific data use the custom filter and sort query string
parameters.
Example:
curl https://myhost.mydomain.com/rest/api/contracts?direct=true
17 November 2022
46 Contract Express® API Manual
/api/contracts/{id}
Method: OPTIONS
Parameters:
Response:
Authorization:
Remarks:
Used by the questionnaire as a "pre-flight" check that the current user has the relevant authority, without
incurring overhead of data retrieval of a successful GET method.
Example:
17 November 2022
API Reference 47
/api/contracts/{id}
Method: GET
Parameters:
Response:
Contract entity with any existing Document child entities and for each of those the current DocumentVersion
entity. Links to questionnaire, answers, documents, template and containing folder.
Authorization:
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42
17 November 2022
48 Contract Express® API Manual
/api/contracts/{id}
Method: PUT
Parameters:
Response:
The updated Contract entity with any existing Document child entities and for each of those the current
DocumentVersion entity. Links to questionnaire, answers, documents, template and containing folder. Content-
type is either application/json or application/xml.
Authorization:
Remarks:
Updates a specified contract. The Contract Id in the entity must match the id used in the Path. IsExplicitName,
ExternalReference, ExternalLabel and Name are set by this action. All other fields are unaffected.
Example:
17 November 2022
API Reference 49
/api/contracts/{id}
Method: DELETE
Parameters:
Response:
No content.
Authorization:
Remarks:
Example:
17 November 2022
50 Contract Express® API Manual
/api/contracts/{id}
Method: POST
Parameters:
Response:
No content.
Authorization:
Requires at least Write permission on the contract and the destination folder, and Use/Folder and
Manage/Contracts authority.
Remarks:
Moves a contract to a new folder. The ACL of the contract remains the same and does not inherit that of the
destination folder.
Example:
17 November 2022
API Reference 51
/api/contracts
Method: GET
Parameters:
Response:
Contract entity with any existing Document child entities and for each of those the DocumentVersion entity
relating to the specified version of the contract. Links to questionnaire, answers, documents, template and
containing folder.
Authorization:
Remarks:
Retrieves the Contract entity that contains the specified Document. The version is the Base64 encoding of the
ContractVersion property of those DocumentVersions to be included in the response. This "reverse" lookup is
useful for retrieving a Contract from information saved in a generated document. Note the response is a single
Contract entity and not a collection as might be expected from the resource path.
Example:
curl https://myhost.mydomain.com/rest/api/contracts?docid=77&version=AAAAAAAA4pI%3d
17 November 2022
52 Contract Express® API Manual
/api/contracts/{id}/acl
Method: GET
Parameters:
Response:
Authorization:
Remarks:
The ACL pair consists of an explicit ACL, which is null if the contract is inheriting its permissions from the containing
folder, and an implicit ACL which is the ACL of the containing folder. Returning both allows the client to distinguish,
and display either without an additional GET request.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/acl
17 November 2022
API Reference 53
/api/contracts/{id}/acl
Method: PUT
Parameters:
Response:
No content.
Authorization:
Remarks:
Set the explicit ACL on the contract. Setting this to null makes the contract inherit the ACL of the containing folder.
Example:
17 November 2022
54 Contract Express® API Manual
/api/contracts/{id}/answers
Method: GET
Parameters:
Response:
An AnswerSet, content-type application/xml. An Etag header is also returned that can be used on subsequent
POST for detecting conflicting updates.
Authorization:
Requires Read permission on the contract, and Use/Contracts and Use/Questionnaires authority.
Remarks:
Retrieves the current answer set for the specified contract. The answer set is typically the answer to questions
provided through the questionnaire, and any explicitly set parameters. The answer set is only available as XML.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/answers
17 November 2022
API Reference 55
/api/contracts/{id}/answers
Method: POST
Parameters:
Response:
No content.
Authorization:
Requires Write permission on the contract, and Use/Contracts and Use/Questionnaires authority.
Remarks:
Merges the submitted answers with the existing answers for the specified contract. Parameter values in the
submitted answers are discarded, as parameters are invariant after contract creation. For requests initiated by a
browser, the ifmatch header is usually automatically populated based on the Etag of the currently cached request,
if there was one.
Example:
17 November 2022
56 Contract Express® API Manual
/api/contracts/{id}/questionnaire/pages/{page}
Method: GET
Parameters:
Response:
Authorization:
Requires Read permission on the contract and the underlying template, and Use/Contracts and
Use/Questionnaires authority.
Remarks:
Retrieves the appropriate questionnaire page definition as XML or JavaScript. JSON is not supported. The
JavaScript representation is well suited to conversion to HTML in a very flexible manner described more fully in
section 5, Embedding the Questionnaire.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/questionnaire/pages/1?navigate=first
17 November 2022
API Reference 57
/api/contracts/{id}/documents
Method: GET
Parameters:
Response:
Contract entity with Document child entities and for each of those the current DocumentVersion entity, and zero
or more GeneratedAlert child entities. Content-type application/json or application/xml.
Authorization:
Requires Read permission on the contract, and on the underlying template if the documents need to be
regenerated, and Use/Contracts and Use/Documents authority.
Remarks:
Note that a Contract entity is returned, rather than a collection of Documents. This method will attempt to
regenerate the documents if there are none that match the current set of Answers. As part of that regeneration
zero or more Alerts may be raised. The Contract entity acts as a container for the Documents and associated
Alerts.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/documents
17 November 2022
58 Contract Express® API Manual
/api/contracts/{id}/documents/{docid}
Method: GET
Parameters:
Response:
Authorization:
Requires Read permission on the contract, and on the underlying template if the documents need to be
regenerated, and Use/Contracts and Use/Documents authority.
Remarks:
This method will attempt to regenerate the documents if there are none that match the current set of Answers.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/documents/77
17 November 2022
API Reference 59
/api/contracts/{id}/documents/{docid}/content
Method: GET
Parameters:
Response:
Returns the content of the specified version of the specified Document. A few content types are supported. The
response will contain a content disposition header of attachment and appropriate filename. An ETag header is
also returned to allow for fulfilment of subsequent requests from cache.
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Documents authority.
Remarks:
If no version is specified, then the latest version of the specified Document is used. The value of the version
parameter is the Base64 encoding of the ContractVersion property of the corresponding DocumentVersion entity.
If there is not a document version associated with the specified version of the contract then regeneration will not
occur, and a "Not found" response will result. Documents generated from templates will default to using the
content-type of application/vnd.openxmlformats-officedocument.wordprocessingml.document. Uploaded
documents will use the content type given during upload. The client can request a response content type of
application/pdf either by using a request Accept header, or by setting the 'pdf' query string parameter to 'true'.
In this case if the system will attempt to convert the document into a PDF, returning a "Not acceptable" response
if this is not possible.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/documents/77/content?pdf=true
17 November 2022
60 Contract Express® API Manual
/api/contracts/{id}/documents/{docid}/signed
Method: GET
Parameters:
Response:
Returns the signed content of the specified Document. The content type will be application/pdf. The response will
contain a content disposition header of attachment and appropriate filename.
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Documents authority.
Remarks:
The returned document will be the output of the external eSignature system. Currently we only support DocuSign
and the content type for this is always PDF.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/documents/77/signed
17 November 2022
API Reference 61
api/upload/documents/{docid}
Method: POST
Parameters:
Response:
No content.
Authorization:
Requires Write permission on the contract and Use/Contracts and Use/Documents authority.
Remarks:
The request content can either be the byte stream of the edited document, or it can be structured as a multi-part
MIME with the single part being the edited document. There must be a Content-Type header on the request.
Usually this will correspond to the DOCX file format, and if so, the document is validated on upload, and is rejected
if it is not a valid DOCX file. In all cases the content type must agree with the content type of the corresponding
generated document. So, it is invalid, for example, to replace a DOCX with a PDF. The uploaded content will replace
the latest version of the specified generated document.
Example:
17 November 2022
62 Contract Express® API Manual
/api/contracts/{id}/documents/{docid}/versions
Method: GET
Parameters:
Response:
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Documents authority.
Remarks:
None.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/documents/77/versions
17 November 2022
API Reference 63
/api/contracts/{id}/documents/{docid}/versions/{verid}
Method: GET
Parameters:
Response:
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Documents authority.
Remarks:
None.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/documents/77/versions/81
17 November 2022
64 Contract Express® API Manual
/api/contracts/{id}/documents/{docid}/versions/{verid}/content
Method: GET
Parameters:
Response:
Returns the content of the specified version of the specified Document. A few content types are supported. The
response will contain a content disposition header of attachment and appropriate filename. An ETag header is
also returned to allow for fulfilment of subsequent requests from cache.
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Documents authority.
Remarks:
Documents generated from templates will default to using the content-type of application/vnd.openxmlformats-
officedocument.wordprocessingml.document. Uploaded documents will use the content type given during
upload. The client can request a response content type of application/pdf either by using a request Accept header,
or by setting the 'pdf' query string parameter to 'true'. In this case the system will attempt to convert the
document into a PDF, returning a "Not acceptable" response if this is not possible.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/documents/77/versions/81/content
17 November 2022
API Reference 65
api/upload/inputdocuments/{id}
Method: POST
Parameters:
Response:
No content. The Location response header will contain the URL for the InputDocument.
Authorization:
Requires Write permission on the contract and Use/Contracts and Use/Questionnaires authority.
Remarks:
The request content can either be the byte stream of the document, or it can be structured as a multi-part MIME
with the single part being the document. There must be a Content-Type header on the request. The uploaded
content is available to attach or include in the set of generated documents for the contract. For the input
document to be used in this way there must be a suitable field in a template that uses a file upload variable that
is set to a value that identifies this input document.
Example:
17 November 2022
66 Contract Express® API Manual
api/contracts /{id}/inputdocuments
Method: GET
Parameters:
Response:
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Questionnaires authority.
Remarks:
None.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/inputdocuments
17 November 2022
API Reference 67
api/contracts /{id}/inputdocuments/{docid}
Method: GET
Parameters:
Response:
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Questionnaires authority.
Remarks:
None.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/inputdocuments/777
17 November 2022
68 Contract Express® API Manual
api/contracts /{id}/inputdocuments/{docid}/content
Method: GET
Parameters:
Response:
Returns the content of the specified InputDocument. Content-type will be as specified during corresponding
upload. The content disposition will be "attachment".
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Questionnaires authority.
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/inputdocuments/777/content
17 November 2022
API Reference 69
api/contracts /{id}/invitations
Method: GET
Parameters:
Response:
Returns a list of Invitation entities for the Contract. Content-type can be application/xml or application/json.
Authorization:
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/invitations
17 November 2022
70 Contract Express® API Manual
api/contracts /{id}/invitations/{itemid}
Method: GET
Parameters:
Response:
Authorization:
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/invitations/1234
17 November 2022
API Reference 71
api/contracts /{id}/invitations/{itemid}
Method: DELETE
Parameters:
Response:
No content.
Authorization:
Remarks:
Full permission is required because the request might restrict who has access to the contract.
Example:
17 November 2022
72 Contract Express® API Manual
/api/contracts/{id}/documents/zip
Method: GET
Parameters:
Response:
All the current document contents for the specified contract as a single zip file. Content-type application/zip.
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Documents authority.
Remarks:
This method will use the default content type of the documents inside the zip archive. No attempt to regenerate
the documents will be made if there are none for the current answer set.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/documents/zip
17 November 2022
API Reference 73
/api/contracts/activity/{year}/{month}
Method: GET
Parameters:
Response:
A list of Activity entities, as content type application/json, application/xml or text/csv. For content type text/csv a
content disposition of attachment is added.
Authorization:
Summarizes only those contracts for which current user has at least Read permission and requires
Manage/Contracts and Use/Queries authority.
Remarks:
The Activity entity in this case states how many times a specific template was used by a particular user in the
specified month. Note that all dates used are based on UTC times. The format parameter is intended for use in
situations where there is no control over the Accept header in the request.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/activity/2014/4
17 November 2022
74 Contract Express® API Manual
/api/contracts/charges/{year}/{month}
Method: GET
Parameters:
Response:
Authorization:
Remarks:
This action allows for the download of an XML file containing data that can be used for pay-per-use charging. Note
that the file will only contain information about Contracts for which the user has at least Read access.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/charges/2015/4
17 November 2022
API Reference 75
/api/contracts/{id}/snapshot
Method: GET
Parameters:
Response:
Returns all the data needed to reconstruct a contract in a different license space, as a single zip file. Content-type
application/zip.
Authorization:
Requires Read permission on the contract and Write permission on all templates used, and Manage/Templates,
Use/Contracts, Use/Documents and Use/Questionnaires authority.
Remarks:
This is intended to aid the investigation of issues a user is having, by providing all the information needed to
reconstruct the scenario in a debug environment, namely the templates, the answers and a record of the activated
pages in the questionnaire and the generated documents. Taking a snapshot does not update the source contract
in any way, for example no attempt to regenerate documents is made.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/snapshot
17 November 2022
76 Contract Express® API Manual
/api/contracts/{id}/templates
Method: GET
Parameters:
Response:
Returns a Dictionary entity for the specified contract. Content-type application/xml or application/javascript. An
Etag header is returned to enable appropriate fulfilment of subsequent requests from cache.
Authorization:
Requires Read permission on the contract, and Use/Contracts and Use/Preview authority.
Remarks:
The returned Dictionary entity is that portion of the consolidated dictionary for the set of templates used by the
contract that defines the usage of attached sub-templates. The application/javascript representation is optimized
for document Preview.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/templates
17 November 2022
API Reference 77
/api/contracts/{id}/templates/{template}/wording
Method: GET
Parameters:
Response:
Returns the template wording of the version of the specified template used by the specified contract as content-
type application/javascript. An Etag header is returned to enable appropriate fulfilment of subsequent requests
from cache.
Authorization:
Requires Read permission on the contract, and Use/Contracts and Use/Preview authority.
Remarks:
The response is the consolidated wording of the top template or an attachment template for the set of templates
used by the contract. The JavaScript is optimized for document Preview and a proportion of the wording text may
have been redacted.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/templates/TestTemplate/wording
17 November 2022
78 Contract Express® API Manual
api/contracts/{id}/templates/uptodate
Method: GET
Parameters:
Response:
Authorization:
Requires at least Read permission on the contract and the underlying template, and Use/Contracts authority.
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/templates/uptodate
17 November 2022
API Reference 79
api/contracts/{id}/templates/uptodate
Method: POST
Parameters:
Response:
No content.
Authorization:
Requires at least Write permission on the contract and Read permission on the underlying template, and
Use/Contracts authority.
Remarks:
Updates the contract to use the most recent versions of the underlying templates.
Example:
17 November 2022
80 Contract Express® API Manual
api/contracts/{id}/ esignature/cancel
Method: POST
Parameters:
Response:
No content.
Authorization:
Remarks:
Example:
17 November 2022
API Reference 81
/api/contracts/{id}/approvals
Method: GET
Parameters:
Response:
A list of Approval entities for the specified Contract. Content-type application/json or application/xml.
Authorization:
Requires Read permission on the contract and Use/Contracts and Use/Approvals authority.
Remarks:
None.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/approvals
17 November 2022
82 Contract Express® API Manual
/api/contracts/{id}/approvals/{title}
Method: GET
Parameters:
Response:
Authorization:
Requires Read permission on the Contract and Use/Contracts and Use/Approvals authority.
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/approvals/Legal
17 November 2022
API Reference 83
/api/contracts/{id}/approvals/{title}
Method: POST
Parameters:
Response:
No content.
Authorization:
Requires Write permission on the Contract and Use/Contracts and Use/Approvals or Manage/Approvals authority
depending on the action.
Remarks:
The title parameter must be a valid string identifier. The action parameter must be one of the values requests,
forward, grab, approve, reject or revoke. If the action is request then Use/Approvals authority is required,
otherwise for all other values Manage/Approvals is required. If the action is grab or forward then the approver
and approvertype parameters must not be null and indicate either the user who has grabbed the approval, or the
user or group to which it has been forwarded. The ApprovalStep associated with this Approval may have been
configured to send emails, in which case this request may trigger the sending of one or more emails.
Example:
17 November 2022
84 Contract Express® API Manual
/api/contracts/{id}/history
Method: GET
Parameters:
Response:
A list of ContractHistory entities for the specified contract. The content-type can be application/json or
application/xml.
Authorization:
Remarks:
Returns a history of events that relate to the specified Contract, with the most recent first. Certain events with
the System property set to true will only be included in the result if the user has Full permission on the Template.
Example:
curl https://myhost.mydomain.com/rest/api/contracts/42/history
17 November 2022
API Reference 85
/api/approvals
Method: GET
Parameters:
Response:
Approval entity list, with no child entities pre-populated and no links. The Content-type is either application/json
or application/xml.
Authorization:
The response will only contain approvals for which the current user has at least Read permission.
Manage/Approvals, Use/Contracts and Use/Queries authority is required.
Remarks:
The underlying query is restricted to the top 1024 Approvals in the 'awaiting approval' state for the most recently
created contracts after applying permissions but before the applying the OData constraints. The intention is that
this query is a queue of items awaiting approval that this user could progress.
Example:
curl https://myhost.mydomain.com/rest/api/approvals
17 November 2022
86 Contract Express® API Manual
/api/folders
Method: GET
Parameters:
Response:
Returns a Folder entity list, with no child entities pre-populated and no links. The Content-type is either
application/json or application/xml.
Authorization:
The response will only contain folders for which the current user has at least Read permission, and where they
have No permission of the parent folder. Use/Folders and Use/Queries authority is required.
Remarks:
The system currently only supports folders for organizing contracts but will in future also allow folders to be used
for organizing templates. The response is effectively the "root" folders accessible to the current user. All other
folders can be accessed indirectly as a descendant of one of these "root" folders.
Example:
curl https://myhost.mydomain.com/rest/api/folders?category=contract
17 November 2022
API Reference 87
/api/folders
Method: POST
Parameters:
Response:
Authorization:
Remarks:
This will create a new absolute "root" folder. An absolute "root" folder is one that really has no parent folder,
rather than one that is just not visible to the current user.
Example:
17 November 2022
88 Contract Express® API Manual
/api/folders/{id}
Method: GET
Parameters:
Response:
Folder entity with any existing Contract and Folder child entities populated. Content-type application/json or
application/xml.
Authorization:
Requires at least Read permission on the folder and Use/Folders authority. The child entities will not be populated
unless the user also has Use/Queries authority.
Remarks:
Example:
curl https://myhost.mydomain.com/rest/api/folders/3
17 November 2022
API Reference 89
/api/folders/{id}
Method: POST
Parameters:
Response:
No content, but with a Location header with the URL of the new folder.
Authorization:
Remarks:
Creates a new sub-folder of the specified folder with the given name. The new folder will inherit the ACL of the
specified folder. The name must not be the same as any existing sub-folders of the specified folder.
Example:
17 November 2022
90 Contract Express® API Manual
/api/folders/{id}
Method: PUT
Parameters:
Response:
Authorization:
Remarks:
Update the Name property of the folder. The name must not be the same as any existing sub-folders of the
specified folder.
Example:
curl --request PUT --header "Content-Type: application/json" --data "{FolderId:3, Name:""My special name""}"
https://myhost.mydomain.com/rest/api/folders/3
17 November 2022
API Reference 91
/api/folders/{id}
Method: DELETE
Parameters:
Response:
No content.
Authorization:
Requires at least Write permission on the folder and all its descendants and Use/Folders authority.
Remarks:
Example:
17 November 2022
92 Contract Express® API Manual
/api/folders/{id}
Method: POST
Parameters:
Response:
No content.
Authorization:
Requires at least Write permission on the folder being moved and the destination folder, and Use/Folders
authority.
Remarks:
Moves a folder to a new parent folder. The ACL of the folder remains the same and does not inherit that of the
new parent folder. A value of zero for the parentid means make the folder an absolute "root" folder, and this
requires CreateRoot/Folders authority.
Example:
17 November 2022
API Reference 93
/api/folders/{id}/acl
Method: GET
Parameters:
Response:
Authorization:
Remarks:
The ACL pair consists of an explicit ACL, which is null if the folder is inheriting its permissions from its parent folder,
and an implicit ACL which is the ACL of the parent folder. Returning both allows the client to distinguish, and
display either without an additional GET request.
Example:
curl https://myhost.mydomain.com/rest/api/folders/3/acl
17 November 2022
94 Contract Express® API Manual
/api/folders/{id}/acl
Method: PUT
Parameters:
Response:
No content.
Authorization:
Remarks:
Set the explicit ACL on the folder. Setting this to null makes the folder inherit the ACL of the parent folder.
Example:
17 November 2022
API Reference 95
/api/folders/{id}/templates
Method: POST
Parameters:
Response:
The fully instantiated TemplateInFolder entity, with the values passed and a unique TemplateInFolderId. The
Content-type is either application/json or application/xml.
Authorization:
Requires Write permission on the folder and Read permission on template, and Use/Folders and
Manage/Templates authority.
Remarks:
Example:
17 November 2022
96 Contract Express® API Manual
/api/folders/{id}/templates
Method: PUT
Parameters:
Response:
The fully TemplateInFolder entity is echoed, with the name property set to the default value if none was specified
in the request. The Content-type is either application/json or application/xml.
Authorization:
Requires Write permission on the folder and Read permission on template, and Use/Folders and
Manage/Templates authority.
Remarks:
This updates the association of a Template and a Profile in a Folder. It allows for the template, profile, name and
description to be updated.
Example:
17 November 2022
API Reference 97
/api/folders/{id}/templates/{linked}
Method: DELETE
Parameters:
Response:
No content.
Authorization:
Requires Write permission on the folder and Read permission on template, and Use/Folders and
Manage/Templates authority.
Remarks:
Example:
17 November 2022
98 Contract Express® API Manual
/api/folders/{id}/contracts
Method: POST
Parameters:
Response:
Contract entity, with no child entities pre-populated. Links to self, questionnaire, answers, documents, and
template. The Content-type is either application/json or application/xml.
Authorization:
Requires Write permission on the folder. When 'minor' is false then requires Read permission on template, and
Use/Folders, Use/Contracts and Use/Templates authority. When 'minor' is true then requires Write permission
on template and Test/Templates instead of Use/Templates authority.
Remarks:
This creates a new contract in the specified folder. ACL of the new contract inherits from that folder. The identity
claims of the user who uploaded the template version are used for determining authorization on sub-templates.
Example:
17 November 2022
API Reference 99
/api/folders/{id}/contracts
Method: GET
Parameters:
Response:
Contract entity list, with no child entities pre-populated. Links to self, questionnaire, answers, documents, and
template. The Content-type is either application/json or application/xml.
Authorization:
The response will only contain contracts for which the current user has at least Read permission. Use/Folders,
Use/Contracts and Use/Queries authority is required.
Remarks:
This returns all the contracts visible to the current user in the specified folder.
Example:
curl https://myhost.mydomain.com/rest/api/folders/3/contracts
17 November 2022
100 Contract Express® API Manual
/api/account/login
Method: POST
Parameters:
None.
Response:
A string which is used as an anti-forgery token. Content type is text/plain. There will also be a Set-Cookie response
header.
Authorization:
The caller needs Use/Licence authority, so must provide credentials via an Authorization header.
Remarks:
This request is only useful where the target instance of Contract Express is configured for Forms Based
Authentication. This call allows the caller to receive an FBA authentication cookie and anti-forgery token that can
be used on subsequent calls. The Authorization header would typically use the Basic or SWT schemes described
in section 4.1 below. This is the programmatic equivalent of the login screen. It is used when embedding the
questionnaire so that the browser has a cookie that will be automatically added to subsequent requests by the
browser.
Example:
curl --request POST --header "Content-Length: 0" –header "Authorization: SWT RG9tYWlu..."
https://myhost.mydomain.com/rest/api/account/login
17 November 2022
API Reference 101
/api/account/logout
Method: POST
Parameters:
None.
Response:
Authorization:
Remarks:
Clears the session cookie. It will also trigger any logout functionality that has been configured for this user.
Example:
17 November 2022
102 Contract Express® API Manual
/api/account/password
Method: POST
Parameters:
Response:
No content.
Authorization:
Remarks:
This will change the current user's password. It requires the old password to be correctly specified as well as the
new one. It will also trigger an email to be sent to the current user alerting them to the fact the password has
been changed and allowing them to reset it easily.
Example:
17 November 2022
API Reference 103
/api/account/settings
Method: GET
Parameters:
Response:
Authorization:
Requires Use/Licence authority to get the current user’s settings by not specifying a value for the userid parameter
and Manage/Licence authority when a userid parameter is specified.
Remarks:
This retrieves various settings relating to the specified user. If the user does not currently exist within the
LicenceSpace, and the Licence allows for another user to be created, then the user will be automatically created
with appropriate default settings. The response object will include a child LicenceSpace object, with any Subsite
specific overrides applied. If userid was not specified, then the UserSettings will have its AuthorizedActions
property set with all the resource/action authorities granted to the current user.
Example:
curl https://myhost.mydomain.com/rest/api/account/settings
17 November 2022
104 Contract Express® API Manual
/api/account/settings
Method: PUT
Parameters:
Response:
No content.
Authorization:
User needs Use/Licence authority to update their own settings or Manage/Licence authority to modify another
user's settings.
Remarks:
Update the settings for the specified user. Not all properties of the UserSettings entity are updateable, and
changes to read only properties will be ignored.
Example:
curl https://myhost.mydomain.com/rest/api/account/settings
17 November 2022
API Reference 105
/api/account/licence
Method: GET
Parameters:
None.
Response:
Authorization:
Remarks:
Returns details of the Licence that governs the LicenceSpace to which the caller belongs.
Example:
curl https://myhost.mydomain.com/rest/api/account/licence
17 November 2022
106 Contract Express® API Manual
/api/account/users
Method: GET
Parameters:
Response:
Authorization:
Remarks:
This returns the list of users that the current user can see and whose names contain the substring specified in the
name parameter. The search space will either correspond to the LicenceSpace or the Subsite to which the caller
belongs.
Example:
curl https://myhost.mydomain.com/rest/api/account/users?name=ted
17 November 2022
API Reference 107
/api/account/groups
Method: GET
Parameters:
Response:
Authorization:
Remarks:
This returns the list of groups that the current user can see and whose names contain the substring specified in
the name parameter. The search space will either correspond to the LicenceSpace or the Subsite to which the
caller belongs.
Example:
curl https://myhost.mydomain.com/rest/api/account/groups?name=dev
17 November 2022
108 Contract Express® API Manual
/api/account/notices
Method: GET
Parameters:
None.
Response:
Returns a list of Notice entities. Supports application/json and application/xml content types.
Authorization:
Remarks:
This returns the list of active Notice entities that have not yet been acknowledged by the current user.
Example:
curl https://myhost.mydomain.com/rest/api/account/notices
17 November 2022
API Reference 109
/api/account/notices
Method: POST
Parameters:
Response:
No content.
Authorization:
Remarks:
This records the id of a Notice entity that is the last which the current user has acknowledged. Notice ids are
monotonically increasing integers, so all prior Notices are also deemed to have been acknowledged.
Example:
curl https://myhost.mydomain.com/rest/api/account/notices?noticeid=42
17 November 2022
110 Contract Express® API Manual
/api/account/permission
Method: POST
Parameters:
Response:
Authorization:
Remarks:
Calculates the effective permission that would be granted to the current user by the Access Control List specified
in the body of the request. The response will be one of None, Read, Write or Full.
Example:
17 November 2022
API Reference 111
/api/account/token
Method: GET
Parameters:
Response:
Returns a string representation of the public token for the specified template with content-type application/json
or application/xml.
Authorization:
Remarks:
Retrieves a token for guest access to a template. When added to the public URL this allows guests to launch the
questionnaire for that template and generate a set of documents. If the profile is specified, then that Profile will
be used when the template is launched. Note the ACL on the template must have been set to allow guest access
and there must be a Major version of the template before the token can be used.
Example:
curl https://myhost.mydomain.com/rest/api/account/token?template=MyTemplate
17 November 2022
112 Contract Express® API Manual
4.2 Entities
This section describes the application specific structured data types. A number of other media types are used by
the system, for example Template and Document content is often represented as Office Open XML, described
here http://en.wikipedia.org/wiki/Office_Open_XML.
The entities themselves have properties that may be a reference to some other entity, or collection of entities,
but more commonly are some scalar value type corresponding to C# long, int, bool, string, DateTime etc.
Entity Comment
EntryPoint The root of the API.
Link A link to a related resource.
Template A template from which documents are generated.
TemplateVersion A particular version of a template.
AccessControlRule Associated with Templates, Contracts and Folders and determines
permission.
Dictionary The Contract Express data structures defined in a Template.
ApprovalStep A step in the approval process associated with a Template.
ast Abstract syntax tree representation of Contract Express Markup
Language expression.
ApprovalEmail Email template for some actions associated with an ApprovalStep.
SystemHistory An event on a Template or in the wider system.
Contract The combination of a Template and an AnswerSet and the resulting
Documents.
AnswerSet The data values for variables used in a Template.
Document A Document generated from a Template.
DocumentVersion A version of a Document generated by a particular AnswerSet.
GeneratedAlert A warning message triggered during the generation of some
Documents.
ContractHistory An event on a Contract.
InputDocument A document uploaded rather than generated.
Invitation An invitation to Collaborate on a Contract.
Approval The progress of an ApprovalStep for a particular Contract.
Folder A container for organizing Contracts and Templates.
Activity A summary of some Activity on the system.
17 November 2022
API Reference 113
Entity Comment
ActivatedPage A questionnaire page.
TemplateInFolder The association of a Template and a Profile to a particular Folder.
Profile A container for a collection of parameter settings and answer values.
ExternalTable The configuration to support the querying of an external data source.
RecordSet The result of a query against an ExternalTable.
View A query against an ExternalTable.
EmailWording Template for an email
Licence Various properties locked by an issued license, such as expiry date.
UserSettings The configuration settings for a particular user.
LicenceSpace Configuration settings that affect all users in a LicenceSapce.
WelcomeScreen Configuration of a Welcome screen shown to new users.
WelcomeImage An image to be included on the welcome screen.
Notice A Notice warning all users on a particular instance of some event, like
down time.
User A registered user.
Group A locally defined group of users.
Subsite A ring-fenced group of users together with a customizable Theme.
Theme Various presentation settings, such as logos and colors.
Each entity description includes a list of its properties, and any links that are included in the entity to other API
requests that might usefully progress some interaction with the services (see the discussion of hypermedia as the
engine of application state in the introduction in section 1).
17 November 2022
114 Contract Express® API Manual
EntryPoint
Properties:
Links:
Name Comment
templateupload The URL for uploading templates.
templates The collection of Template entities accessible to the current user.
contracts The collection of Contract entities accessible to the current user.
Remarks:
This data is the "root" of the API. It asserts various legal claims and provides links to other resources. Supports
JSON and XML serialization.
17 November 2022
API Reference 115
Link
Properties:
Links:
None.
Remarks:
Link entities are used to suggest potential requests to progress some activity in the response to some earlier
request. For example, the response to the main entry point of the API has links to the major resource collections.
Supports JSON and XML serialization.
17 November 2022
116 Contract Express® API Manual
Template
Properties:
17 November 2022
API Reference 117
Links:
Name Comment
newcontract The URL for creating a new contract from this template.
Remarks:
The Template entity holds properties of a particular template, or a template and profile combination, including
some properties of the current version of that template. The current version is the version (test or live depending
on context) that is valid at the moment the request was made. Supports JSON and XML serialization.
17 November 2022
118 Contract Express® API Manual
TemplateVersion
Properties:
Links:
None.
Remarks:
Properties of a particular version of a template. Note that EffectiveRight does not vary between versions; it is
really a property of the Template but is included here as a convenience. Supports JSON and XML serialization.
17 November 2022
API Reference 119
AccessControlRule
Properties:
Links:
None.
Remarks:
AccessControlRule entities are combined in a sequence to form an Access Control List (ACL) for a given securable
object, such as a specific template, folder, or contract. For the "role" claim, the allowed values are "admin",
"author", "user" or "guest". For the "group" or "userid" claim the allowed values are any user or group that has
been created in the current license space. The rights are cumulative, so "Full" implies "Write", which in turn implies
"Read"; in this model it is not possible to grant "Write" permission without also granting "Read" permission.
Supports JSON and XML serialization.
17 November 2022
120 Contract Express® API Manual
Dictionary
Properties:
See Remarks.
Links:
None.
Remarks:
A Dictionary describes a rich collection of objects used by a template, such as the set of variables, the
questionnaire pages, lookup tables etc. The Dictionary entity is only available as XML. The XML schema for the
Dictionary (dictionary.xsd) accompanies this manual.
17 November 2022
API Reference 121
ApprovalStep
Properties:
17 November 2022
122 Contract Express® API Manual
Links:
None.
Remarks:
An ApprovalStep entity defines one step of an approval process that may be required before a business user gets
access to the generated documents. A number of approval steps, either sequentially or in parallel, may be
combined to define the whole approval process for documents produced by a template. Supports JSON and XML
serialization.
17 November 2022
API Reference 123
ast
Properties:
Links:
None.
Remarks:
An "ast" entity represents an abstract syntax tree of an expression in the Contract Express Markup Language
(CEML). Each node in the tree has a symbol and a value, and a list of zero or more subtrees. For example, the
CEML expression "Age > 42" would be represented as the node "op/greaterthan" with two children "variable/age"
and "integer/42". This is used, for example, as a convenient representation for the construction and editing of the
rules associated with an ApprovalStep. Supports JSON and XML serialization.
17 November 2022
124 Contract Express® API Manual
ApprovalEmail
Properties:
Links:
None.
Remarks:
An ApprovalEmail entity is associated with a specific ApprovalStep and acts as a template for the generation of
emails intended for one of a number of predefined purposes. Supports JSON and XML serialization.
17 November 2022
API Reference 125
SystemHistory
Properties:
Links:
None.
Remarks:
A SystemHistory entity details some event that has occurred within the system that may be related to a Template.
Supports JSON and XML serialization.
17 November 2022
126 Contract Express® API Manual
Contract
Properties:
17 November 2022
API Reference 127
Links:
Name Comment
questionnaire The activated questionnaire pages for this contract.
answers The answers provided for this contract.
documents The documents produced for this contract.
folder The folder containing this contract.
template The template from which this contract was created.
Remarks:
A Contract entity is a container for a set of documents produced by applying answer data to a template (and any
sub-templates). There may be zero or more documents. There will be exactly one "top" template. Supports JSON
and XML serialization.
17 November 2022
128 Contract Express® API Manual
AnswerSet
Properties:
See Remarks.
Links:
None.
Remarks:
An AnswerSet describes a rich collection of data used (or produced) by a set of templates, such as the answers
provided for question variables, the parameter settings used, and blocks of export data. The AnswerSet entity is
only available as XML. The XML schema (answers.xsd) for an answer set accompanies this manual.
17 November 2022
API Reference 129
Document
Properties:
Links:
None.
Remarks:
Properties of a logical document, of which there may be many versions, but which would be considered versions
of the "same" document. Supports JSON and XML serialization.
17 November 2022
130 Contract Express® API Manual
DocumentVersion
Properties:
Links:
None.
Remarks:
Properties of a specific version of a generated document. Supports JSON and XML serialization.
17 November 2022
API Reference 131
GeneratedAlert
Properties:
Links:
None.
Remarks:
Alerts are defined in the templates, with a condition that triggers the alert. Compulsory alerts are ones that must
be resolved before documents can be produced. Supports JSON and XML serialization.
17 November 2022
132 Contract Express® API Manual
ContractHistory
Properties:
Links:
None.
Remarks:
A SystemHistory entity details some event that has occurred within the system that may be related to a Template.
Supports JSON and XML serialization.
17 November 2022
API Reference 133
InputDocument
Properties:
Links:
None.
Remarks:
An InputDocument is a document that is not known to have been generated by the answer set applied to the
templates for this Contract. It is usually a document for a source other than Contract Express that has been
uploaded in response to a file upload question in the questionnaire. Such document can be attached to the set of
generated documents, or for a limited subset of content types can be included in the wording of a generated
document. Supports JSON and XML serialization.
17 November 2022
134 Contract Express® API Manual
Invitation
Properties:
Links:
None.
Remarks:
An Invitation to an external party to collaborate on a Contract. The invitation will be sent by email and will contain
a token granting that user access for a fixed period of time. Supports JSON and XML serialization.
17 November 2022
API Reference 135
Approval
Properties:
Links:
None.
Remarks:
An Approval entity tracks the application of an ApprovalStep to a particular Contract. There may be more than
one Approval per Contract. Supports JSON and XML serialization.
17 November 2022
136 Contract Express® API Manual
Folder
Properties:
Links:
None.
Remarks:
Folders are arranged in a tree structure. A folder has at most one parent but can have zero or more sub-folders.
A folder with no parent is a "root" folder. Supports JSON and XML serialization.
17 November 2022
API Reference 137
Activity
Properties:
Links:
None.
Remarks:
Activity entities are used for simple reporting. For example, with contracts, it says how much (HowMany) a user
(Who) has used a template (What). Supports JSON, XML, and comma separated vale (CSV) serialization.
17 November 2022
138 Contract Express® API Manual
ActivatedPage
Properties:
Links:
Name Comment
self The request to refresh the current page.
previous The request to get the previous relevant page.
next The request to get the next relevant page.
first The request to get the first relevant page.
last The request to get the last relevant page.
answers The request to get the current full answer set.
documents The request to get the documents generated from the current answers.
Remarks:
The ActivatedPage is a representation of a questionnaire page. It can be serialized as XML or as JavaScript (not
JSON). Various elements of the dictionary are expressions, primarily to represent dynamic on page behavior. These
will be executable JavaScript if that serialization format is chosen, or Contract Express Mark-up Language in the
XML format.
17 November 2022
API Reference 139
TemplateInFolder
Properties:
Links:
None.
Remarks:
TemplateInFolder entities are a way of presenting an underlying Template to a user as if it was a different
template, through the application of a Profile. You may choose to use a different name to refer to this combination
and provide a more specific description. Such combinations are also arranged into Folders, to make them easier
for a user to discover. Note that a user can only access a Template if they have access to the underlying Template
via its Access Contol List, and they have access to a Folder with which that Template is associated, according to
the Folder's Access Control List. Imagine a world in which there is only one Template, capable of generating any
document. Such a Template might require the user to answer an unreasonable number of questions.
TemplateInFolder structures allow a user to experience this one template as if it was a library of templates by
jump starting a session with a predefined sub-set of answers in the Profile. We poor mortals fall short of this ideal
and are only capable of writing approximations to this supreme Template, that cover some subset of all possible
documents, but even so the FolderInTemplate concept can still be useful. Supports JSON and XML serialization.
17 November 2022
140 Contract Express® API Manual
Profile
Properties:
Links:
None.
Remarks:
A profile is a collection of parameter settings that control various aspects of system behavior, and optionally some
answer values to question variables. The Profile entity holds a few metadata values for the profile itself, which is
represented in exactly the same format as an AnswerSet. Supports JSON and XML serialization.
17 November 2022
API Reference 141
ExternalTable
Properties:
Links:
None.
Remarks:
ExternalTable entities define the means of accessing some external managed tabular data source. Supports JSON
and XML serialization.
17 November 2022
142 Contract Express® API Manual
RecordSet
Properties:
See Remarks.
Links:
None.
Remarks:
A recordset is the result of an ExternalTable query. The recordset entity is only available as XML. It comprises a
root 'recordset' element with zero or more 'row' elements, each with one or more 'field' elements. The text value
of the field element is the value of that field of that row in the recordset. In this way it describes a tabular collection
of values. The XML schema (recordset.xsd) for a recordset accompanies this manual.
17 November 2022
API Reference 143
View
Properties:
See Remarks.
Links:
None.
Remarks:
A View defines a query that can be presented to an ExternalTable. The View entity is only represented as XML. It
is based for legacy reasons on a subset of the SharePoint CAML View schema (https://msdn.microsoft.com/en-
us/library/office/ms438338.aspx ). The XML Schema for the subset we use (camlsubset.xsd) accompanies this
manual.
17 November 2022
144 Contract Express® API Manual
EmailWording
Properties:
Links:
None.
Remarks:
EmailWording entity represents an email template used for generating certain emails. Currently two templates
are used by the system, named "User invitation into the system" and the other "Guest invitation to edit a
contract". The Subject and Body can contain fields that will be given a value appropriate to their context. Supports
JSON and XML serialization.
17 November 2022
API Reference 145
Licence
Properties:
Links:
Name Comment
adverts The URL for the public page for this license, with links to "advertised" templates.
Remarks:
The Licence entity contains those properties enforced by the terms of the licence issued. This may be an
automatically generated trial licence or it may be a full licence issued by Thomson Reuters. Supports JSON and
XML serialization.
17 November 2022
146 Contract Express® API Manual
UserSettings
Properties:
Links:
None.
Remarks:
The UserSettings entity represents user specific configuration settings. Supports JSON and XML serialization.
17 November 2022
API Reference 147
LicenceSpace
Properties:
Links:
None.
Remarks:
The LicenceSpace entity represents configuration settings that affect all users covered by a particular license.
Supports JSON and XML serialization.
17 November 2022
148 Contract Express® API Manual
WelcomeScreen
Properties:
Links:
None.
Remarks:
The WelcomeScreen entity allows an administrator to configure a welcome screen with various useful resources
including some text, a video, some links to other resources and some images. Supports JSON and XML serialization.
17 November 2022
API Reference 149
WelcomeImage
Properties:
Links:
None.
Remarks:
The WelcomeImage entity holds the title and some descriptive text for an image to be shown on the welcome
screen. Supports JSON and XML serialization.
17 November 2022
150 Contract Express® API Manual
Notice
Properties:
Links:
None.
Remarks:
The Notice entity describes some system wide event of which users need to be made aware. This might for
example be some downtime to allow for system upgrade or maintenance. The NoticeId is a monotonically
increasing value so that it is easy to track which Notices have been acknowledged by a given user. The properties
once saved are immutable as they must not change after a user has acknowledged them. Supports JSON and XML
serialization.
17 November 2022
API Reference 151
User
Properties:
Links:
None.
Remarks:
17 November 2022
152 Contract Express® API Manual
Group
Properties:
Links:
None.
Remarks:
A locally defined group of users in the LicenceSpace. Supports JSON and XML serialization.
17 November 2022
API Reference 153
Subsite
Properties:
Links:
None.
Remarks:
A Subsite allows for a group of users in a LicenceSpace to be separated from other users, and various properties
of the LicenceSpace to be varied for that group. For example, a different Theme can be applied, or the automatic
deletion of contracts can be set. Every Subsite is associated with a Group of the same name, where the Limit
property of the Group is set to True. Supports JSON and XML serialization.
17 November 2022
154 Contract Express® API Manual
Theme
Properties:
Links:
Name Comment
style The definition of various styles used in the front end.
image1 The primary image used by this Theme.
image2 The secondary image used by this Theme.
self A link back to itself.
Remarks:
A Theme entity holds some metadata properties for a theme. A theme is a way of customizing certain aspects of
the look-and-feel of the Contract Express application, such as the colors used and the header logo image. Supports
JSON and XML serialization.
17 November 2022
Embedding the Questionnaire 155
A questionnaire is launched by referencing the MVC page EditContract in some URL. The parameters that are
included in the URL determine which contract is edited and how it is edited.
The target of the URL can be a browser window itself, or it can be the SRC property of an HTML <IFRAME> element
that is embedded within a window.
The named parameters that determine which contract is edited and how it is edited are:
• ContractIdentifier
• ReadOnly
• Layout
• Format
• Color
• UserTheme
• IgnoreParent
• OnFinish
ContractIdentifier
This is a numeric value that uniquely identifies the contract within the license space.
ReadOnly
This is a boolean value that specifies whether the edit is read-only; that is, when set to true it is effectively a review
of the contract values.
Layout
This is a text value that determines how the editing elements, and in particular each page of the questionnaire,
are arranged. It is one of:
17 November 2022
156 Contract Express® API Manual
• Nelson A single column questionnaire that adapts to the width of the device.
• Standard Provides backwards compatibility with CEDB versions 4.4 and 4.5.
Format
This is a text value that specifies the widest width boundary for the questionnaire HTML elements. It is one of:
If this is not supplied, then the format will be determined solely by the device. Similarly, if this is supplied but the
actual width of the device is not wide enough to support it then the format will also be determined by the device.
The format is used by the layout procedure. For example, the Nelson layout presents the potential questionnaire
pages as a static list to the left of the questions in Wide format but presents them as a popup list above the
questions in Trim and Narrow format.
Color
This is a text value that determines the color scheme. Different layouts support different color schemes:
UserTheme
This is a text value that determines certain user-specific variations, such as the color of the Previous/Next/Save &
Close icons so that they match the user's theme in Contract Express Cloud.
If this is not supplied, then there are no variations to the color scheme.
17 November 2022
Embedding the Questionnaire 157
IgnoreParent
This is a boolean value that is used only when the questionnaire is embedded within an <IFRAME> of some parent
window. When set to true the questionnaire behaves as if it were not within an <IFRAME> element but was within
the top window of the browser. In particular, no messages are posted to the parent window, and no messages
from the parent window are handled, as in section 5.1.3 (<IFRAME> does not communicate with Parent) below.
OnFinish
This is a numeric value that specifies what action to take when the user finishes editing the contract.
If the questionnaire is embedded within an <IFRAME> element that is communicating with its parent window, as
in 5.1.3 (<IFRAME> communicates with Parent) below, then this parameter is ignored. Otherwise:
When the target of the EditContract URL is the top window of a browser then the questionnaire adjusts the format
(wide/trim/narrow) according to the inner-width of that window and adjusts the height of the questionnaire
according to its inner-height.
When the target of the EditContract URL is an <IFRAME> element, its format (wide/trim/narrow) and its available
height are determined by whether or not the <IFRAME> element is communicating with its parent window.
A questionnaire that is embedded within an <IFRAME> element does not attempt to communicate with its parent
window if the URL includes the parameter:
IgnoreParent = true
Its format (wide/trim/narrow) is determined by the inner-width of the <IFRAME> window, and its available height
is determined by that window's inner-height.
A questionnaire that is embedded within an <IFRAME> element communicates with its parent window if the URL
includes the parameter:
IgnoreParent = false
17 November 2022
158 Contract Express® API Manual
Its format (wide/trim/narrow) is determined by the inner width of the <IFRAME> window, and its available height
is determined by the parent window's response when the height is requested.
The communication between the <IFRAME> element and its parent window is accomplished by posting messages.
Note that message posting is asynchronous. The JavaScript execution process in which a request-style message is
posted must terminate before any response-style message can be handled.
17 November 2022
Embedding the Questionnaire 159
17 November 2022
160 Contract Express® API Manual
window.parent.postMessage("response:save:", "*");
window.parent.postMessage("response:save:There are 4 errors on the questionnaire!", "*");
window.parent.postMessage("request:size", "*");
window.parent.postMessage("request:size:fullwidth", "*");
window.parent.postMessage("request:scrolltotop", "*");
window.parent.postMessage("request:finish", "*");
window.parent.postMessage("request:timeout", "*");
17 November 2022
Embedding the Questionnaire 161
function handlePostedMessage(_Event) {
var _MessageText = _Event.originalEvent.data;
var _MessageTextLower = _MessageText.toLowerCase();
// handle a response to original request save the data on the current questionnaire page
if (_MessageTextLower.substr(0, 14) === "response:save:") {
var _SaveResponseText = _MessageText.substr(14);
if (_SaveResponseText !== "") {
alert(_SaveResponseText);
}
}
// handle a request for the size of the IFRAME element in full width mode
else if (_MessageTextLower === "request:size:fullwidth") {
var _IframeElement = ... ;
var _Height = ... ;
var _Width = ... ;
var _SizeResponseText = "response:size:" + _Height.toString() + "x" + _Width.toString();
_IframeElement.contentWindow.postMessage(_SizeResponseText, "*");
}
Those clients that have deployed an instance of Contract Express may, if they wish, design and style their own
questionnaire layout.
In the following sections, by way of example, the design of the Nelson layout is given. It shows what JavaScript
functions must be defined by the client in a custom layout, and which Contract Express interface functions are
used in that design. See section 5.4 (JavaScript Library) for a complete list of the interface functions.
In summary, the JavaScript functions which must be defined by a custom layout are:
17 November 2022
162 Contract Express® API Manual
17 November 2022
Embedding the Questionnaire 163
This questionnaire layout adapts itself according to the available width of the device.
In trim format (between 600px and 1024px) the preview document appears underneath the questionnaire.
In wide format (more than 1024px) the preview document appears to the right of the questionnaire.
In all formats the variables are arranged in a single column occupying the full width available, with the variable
prompt appearing above the input value, and the guidance appearing below.
This function is called by Contract Express during initialization and whenever the format changes. Its purpose is to
build the HTML elements that are independent of any specific questionnaire page.
Part of the procedure will be locating the alerts, locating the questionnaire, and locating any preview document.
Firstly, preview will only be made available in wide or trim format, and when preview has been enabled.
var _PreviewVisible = ((_Format === "wide" || _Format === "trim") && _PreviewEnabled);
The following two JavaScript variables will be instantiated to HTML elements where the questionnaire and the
preview document will be located, respectively.
var _QuestionnaireLocation = null;
var _PreviewLocation = null;
The overall structure consists of a top <DIV> for the actionable items, and a bottom <DIV> which will contain the
contract details. Note that new <DIV> elements are created using the general interface function CreateElement.
var _StructuralTop = ContractExpress.CreateElement(_HostElement, "DIV", {});
var _StructuralBottom = ContractExpress.CreateElement(_HostElement, "DIV", {});
The first element in the top <DIV> informs the user that the contract is read-only. Note this uses the interface
function CreateReadOnlyButton, and the message will only appear if the contract is indeed read-only.
17 November 2022
164 Contract Express® API Manual
The next elements in the top <DIV> are the inter-page navigation buttons which use the interface functions
CreatePreviousPageButton and CreateNextPageButton, respectively. They each have an associated icon which is
created by the interface function CreateIcomoon. Note that these buttons will automatically enable/disable
depending upon the circumstances.
ContractExpress.CreateIcomoon(_StructuralTop, "SPAN", { icon: "ArrowLeft" });
ContractExpress.CreatePreviousPageButton(_StructuralTop, "A", {});
ContractExpress.CreateIcomoon(_StructuralTop, "SPAN", { icon: "ArrowRight" });
ContractExpress.CreateNextPageButton(_StructuralTop, "A", {});
The next element in the top <DIV> is the button which toggles the visibility of the preview document, and which
uses the interface function CreatePreviewToggle.
if (_PreviewVisible) {
ContractExpress.CreateIcomoon(_StructuralTop, "SPAN", { icon: "Document" });
ContractExpress.CreatePreviewToggle(_StructuralTop, "A", {});
}
The final element in the top <DIV> is the button to terminate the session, which uses the interface function
CreateFinishButton.
ContractExpress.CreateIcomoon(_StructuralTop, "SPAN", { icon: "Template" });
ContractExpress.CreateFinishButton(_StructuralTop, "A", {});
The bottom division in narrow format is entirely devoted to the questionnaire, as preview is not available.
if (_Format === "narrow") {
_QuestionnaireLocation = _StructuralBottom;
}
The bottom division in trim format has the questionnaire above the preview document, with a draggable resizer
between them to change their relative heights. This whole arrangement is accomplished using the interface
function CreateResizer.
else if (_Format === "trim") {
var _Resizer = ContractExpress.CreateResizer(_StructuralBottom, "Resizer", false, false);
_QuestionnaireLocation = _Resizer.top;
_PreviewLocation = _Resizer.bottom;
}
In wide format the bottom division consists of a left <DIV> for the progress information and alerts, and a right
<DIV> for both the questionnaire and the preview document. When the preview document is made visible, the
left <DIV> is hidden and the right <DIV> expands leftwards to fill the void.
else if (_Format === "wide") {
NelsonElementWideLeft = ContractExpress.CreateElement(_StructuralBottom, "DIV", {});
NelsonElementWideRight = ContractExpress.CreateElement(_StructuralBottom, "DIV", {});
}
The first element at the top of the left <DIV> is a question progress bar, which uses the interface function
CreateQuestionProgressBar.
17 November 2022
Embedding the Questionnaire 165
Immediately below is a list of all the questionnaire pages, which uses the interface function
CreatePageNavigationList.
The final element at the bottom of the left <DIV> is a placeholder where alerts are raised. This uses the interface
function SetAlertsLocation.
var _AlertsDiv = ContractExpress.CreateElement(NelsonElementWideLeft, "DIV", {});
ContractExpress.SetAlertsLocation(_AlertsDiv);
The right <DIV> has the questionnaire to the left of the preview document, with a draggable resizer between them
to change their relative widths. This whole arrangement is accomplished using the interface function
CreateResizer.
var _Resizer = ContractExpress.CreateResizer(NelsonElementWideRight, "Resizer", true, false);
_QuestionnaireLocation = _Resizer.left;
_PreviewLocation = _Resizer.right;
The questionnaire
ContractExpress.SetQuestionnaireLocation(_QuestionnaireLocation);
If the preview document is available, then its location is set using the interface function SetPreviewLocation.
if (_PreviewVisible) {
ContractExpress.SetPreviewLocation(_PreviewLocation);
}
The preview host element consists of a static area that does not scroll sitting above the scrollable document
wording, and which uses the interface function CreatePreviewDocument.
var _PreviewBar = ContractExpress.CreateElement(_PreviewLocation, "DIV", {});
ContractExpress.CreatePreviewDocument(_PreviewLocation, "DIV", {});
The first element in the static area holds any attachment documents that may also be previewed, together with
buttons for tabbing between them. This uses the interface function CreatePreviewDocumentTabGroup.
The remaining elements in the static area are buttons for navigating between occurrences of the selected variable
in the document wording. These use the interface functions CreatePreviewOccurrencePrevious,
CreatePreviewOccurrenceNumber, and CreatePreviewOccurrenceNext.
ContractExpress.CreatePreviewOccurrencePrevious(_PreviewBar, "SPAN", { icomoon: { icon: "ArrowLeft" } });
ContractExpress.CreatePreviewOccurrenceNumber(_PreviewBar, "SPAN", {});
ContractExpress.CreatePreviewOccurrenceNext(_PreviewBar, "SPAN", { icomoon: { icon: "ArrowRight" } });
17 November 2022
166 Contract Express® API Manual
Recall that the location of the alerts was established when building the skeleton.
This function is called by Contract Express on each inter-page navigation, whenever the number of on-page
repetitions varies, and whenever the skeleton is re-built.
function cetBuildAlerts(_HostElement)
{
The list of alerts may vary from one questionnaire page to the next, depending upon which variables are
mentioned in those alerts. This list is provided by Contract Express using the interface function
AllAlertsOnThisPage.
The Nelson layout lists all compulsory alerts above any non-compulsory alerts. The test uses the interface function
AlertIsCompulsory and the alert itself uses the interface function CreateAlert.
if (ContractExpress.AlertIsCompulsory(ALERTOBJECT)) {
ContractExpress.CreateAlert(_HostElement, "DIV", { icomoon: { icon: "Error" } }, ALERTOBJECT);
}
}
if (!ContractExpress.AlertIsCompulsory(ALERTOBJECT)) {
ContractExpress.CreateAlert(_HostElement, "DIV", { icomoon: { icon: "Error" } }, ALERTOBJECT);
}
}
Recall that the location of the questionnaire was established when building the skeleton.
This function is called by Contract Express on each inter-page navigation, whenever the number of on-page
repetitions varies, and whenever the skeleton is re-built.
In addition to the format parameter, the function is also parameterized with the actual width allocated to the
questionnaire. This additional information is provided if the custom layout wishes to be more precise about how
questionnaires are constructed.
17 November 2022
Embedding the Questionnaire 167
Page Title
Recall that the list of questionnaire pages, including the currently selected questionnaire page, is only made visible
in wide format. And so, the questionnaire begins with the page title for trim and narrow formats using the
interface function CreatePageTitle.
Page Guidance
The next element in the questionnaire is the page guidance, if it exists, using the interface functions
PageGuidanceExists, and CreatePageGuidance.
if (ContractExpress.PageGuidanceExists()) {
ContractExpress.CreatePageGuidance(_HostElement, "DIV", { icomoon: { icon: "Info" } });
}
Alerts
Recall that the alerts are only located in wide format. And so, for trim and narrow formats, the alerts are explicitly
added to the questionnaire by calling the layout function cetBuildAlerts.
Groups
A questionnaire page consists of a collection of variables that are partitioned into distinct groups. The list of groups
is provided by Contract Express using the interface function AllGroupsOnThisPage.
Group Title
Each group begins with the group title using the interface function CreateGroupTitle.
Group Guidance
The group title is followed by any group guidance using the interface functions GroupGuidanceExists and
CreateGroupGuidance.
17 November 2022
168 Contract Express® API Manual
if (ContractExpress.GroupGuidanceExists(GROUPOBJECT)) {
ContractExpress.CreateGroupGuidance(_HostElement, "DIV", {}, GROUPOBJECT);
}
Grid of Repetitions
If the group contains repeated variables and its presentation is in the form of a grid, either repeating across or
repeating down, then the values of those variables are laid out as a read-only table with an explicit button that
enables the user to edit them separately. This uses the interface functions GroupIsRepeatedGridAcross,
GroupIsRepeatedGridDown and CreateRepetitionGridEditButton, and calls the layout function
cetBuildRepeatGrid defined in section 5.2.5 (Building a Repetition Grid) below. Note that the edit button occurs
alongside the group title.
if (ContractExpress.GroupIsRepeatedGridAcross(GROUPOBJECT)
|| ContractExpress.GroupIsRepeatedGridDown(GROUPOBJECT)) {
ContractExpress.CreateRepetitionGridEditButton(_GroupTitle, "A", {}, GROUPOBJECT);
cetBuildRepeatGrid(_HostElement, false, false, 0, GROUPOBJECT);
}
Group Repetitions
Whether or not the variables in a group are actually repeated, Contract Express assumes that groups always have
repetitions. The test for whether or not a repetition of a group contains repeated variables uses the interface
function ActualRepetition.
The list of repetitions of a group is provided by Contract Express using the interface function
AllRepetitionsOfThisGroup.
else
{
var REPETITIONOBJECTS = ContractExpress.AllRepetitionsOfThisGroup(GROUPOBJECT);
Repetition Title
The title of a particular repetition of a group, together with the navigation and management buttons, is conditional
upon it actually having some repeated variables. This uses the interface functions ActualRepetition,
CreateRepetitionTitle, CreateRepetitionNavigationButtons, and CreateRepetitionManagementButtons.
if (ContractExpress.ActualRepetition(REPETITIONOBJECT)) {
var _RepeatHeader = ContractExpress.CreateElement(_HostElement, "DIV", {});
ContractExpress.CreateRepetitionTitle(_RepeatHeader, "H3", {}, REPETITIONOBJECT);
ContractExpress.CreateRepetitionNavigationButtons(_RepeatHeader, "DIV", {}, REPETITIONOBJECT);
ContractExpress.CreateRepetitionManagementButtons(_RepeatHeader, "DIV", {}, REPETITIONOBJECT);
}
Variables
The list of variables in a repetition, whether or not they are actually repeated, is provided by Contract Express
using the interface function AllVariablesInThisRepetition.
17 November 2022
Embedding the Questionnaire 169
Variable Body
The components of a variable consist of its preamble text, its prompt text, its guidance text, its input values, and
an area for reporting invalid values. These are collected together using the interface function CreateVariableBody.
When a variable becomes relevant or irrelevant, or when a variable is selected by a mouse click or tab operation,
it is the complete variable body that is re-styled.
Variable Preamble
A variable begins with any preamble text using the interface functions VariablePreambleExists and
CreateVariablePreamble.
if (ContractExpress.VariablePreambleExists(VARIABLEOBJECT)) {
ContractExpress.CreateVariablePreamble(_VariableBody, "DIV", {}, VARIABLEOBJECT);
}
Variable Validation
The area reserved for validation messages occurs above the other components and uses the interface function
CreateVariableValidation.
Variable Prompt
The next component is the variable's prompt text which uses the interface function CreateVariablePrompt.
Variable Value
The next component is the variable's input elements which uses the interface function CreateVariableValue.
Variable Guidance
The final component is the variable's guidance text which uses the interface functions VariableGuidanceExists
and CreateVariableGuidance.
if (ContractExpress.VariableGuidanceExists(VARIABLEOBJECT)) {
ContractExpress.CreateVariableGuidance(_VariableBody, "DIV", {}, VARIABLEOBJECT);
}
17 November 2022
170 Contract Express® API Manual
Next Page
Finally, at the bottom of the questionnaire is a replica button for navigating to the next questionnaire page. It uses
the interface functions NextPageExists, CreateNextPageButton, and CreateFinishButton.
if (ContractExpress.NextPageExists()) {
ContractExpress.CreateNextPageButton(_HostElement, "A", {});
}
else {
ContractExpress.CreateFinishButton(_HostElement, "A", {});
}
OnPageLoad
Immediately after the questionnaire page has been constructed, and when all variable values have been assigned,
and when all effects have been processed, Contract Express calls back to the layout. This gives the layout an
opportunity to process its own effects, such as re-styling elements.
This function may be called from the layout function cetBuildQuestionnaire, and whenever the user explicitly edits
the grid.
When called from cetBuildQuestionnaire, the host element for the grid will be within the questionnaire itself. For
a user edit the host element will be a modal-style <DIV> that occupies the full width and height of the <IFRAME>,
and which contains a button to close the edit. Upon a close the questionnaire is re-drawn and scrolled to its
original position before the edit.
When the grid is hosted in the modal-style <DIV> it is headed by the group title, group guidance and a close button
using the interface functions CreateGroupTitle, GroupGuidanceExists, CreateGroupGuidance and
CreateRepetitionGridCloseButton.
if (_CloseEnabled) {
var _GroupTitle = ContractExpress.CreateGroupTitle(_HostElement, "H2", {}, GROUPOBJECT);
if (ContractExpress.GroupGuidanceExists(GROUPOBJECT)) {
ContractExpress.CreateGroupGuidance(_HostElement, "DIV", {}, GROUPOBJECT);
}
}
17 November 2022
Embedding the Questionnaire 171
Group Repetitions
The list of repetitions of a group is provided by Contract Express using the interface function
AllRepetitionsOfThisGroup.
Group Variables
The list of variables in a group is arbitrarily found in the first repetition using the interface function
AllVariablesInThisRepetition.
Grid <TABLE>
The grid, whether repeating down or repeating across, is laid out as a <TABLE> using the interface function
CreateElement.
Repeat Down
The test for a grid which repeats down the table uses the interface function GroupIsRepeatedGridDown.
if (ContractExpress.GroupIsRepeatedGridDown(GROUPOBJECT))
{
The first row contains the prompts for all the variables and uses the interface functions CreateElement and
CreateVariablePrompt.
The intermediate rows contain the repetitions using the interface function CreateElement.
17 November 2022
172 Contract Express® API Manual
Each row begins with the title of a particular repetition of a group using the interface function
CreateRepetitionTitle.
Repetitions are only inserted and deleted from the questionnaire itself, and not when the user is editing values.
This uses the interface function CreateRepetitionManagementButtons.
if (!_CloseEnabled) {
ContractExpress.CreateRepetitionManagementButtons(_RepeatHeader, "DIV", {}, REPETITIONOBJECT);
The other columns of a repetition contain the input elements for each of the variables, using the interface
functions AllVariablesInThisRepetition and the layout function cetBuildRepeatGridVariableValue.
The last row contains the guidance for all the variables and uses the interface functions CreateElement and
CreateVariableGuidance.
Repeat Across
The test for a grid which repeats across the table uses the interface function GroupIsRepeatedGridAcross.
else if (ContractExpress.GroupIsRepeatedGridAcross(GROUPOBJECT))
{
The first row contains all the repetition titles using the interface function CreateRepetitionTitle.
17 November 2022
Embedding the Questionnaire 173
Repetitions are only inserted and deleted from the questionnaire itself, and not when the user is editing values.
This uses the interface function CreateRepetitionManagementButtons.
if (!_CloseEnabled) {
ContractExpress.CreateRepetitionManagementButtons(_RepeatHeader, "DIV", {}, REPETITIONOBJECT);
}
The other rows contain the prompt, values, and guidance for each of the repetition variables in the repetition.
Each row begins with the variable prompt using the interface function CreateVariablePrompt.
The intermediate columns of contain the input elements for each of the variables, using the interface functions
AllVariablesInThisRepetition and the layout function cetBuildRepeatGridVariableValue.
Each row ends with the variable guidance using the interface function CreateVariableGuidance.
Variable Value
This subsidiary function in the layout definition is used by grids that repeat down and grids that repeat across.
17 November 2022
174 Contract Express® API Manual
When editing of the grid is not enabled the table cell contains the formatted value of the variable. This uses the
interface function GetVariableValueFormatted.
if (!_EditEnabled) {
var _ValueText = ContractExpress.GetVariableValueFormatted(VARIABLEOBJECT)
} ) ;
When editing of the grid is enabled the table cell contains the input elements for the variable. This uses the
interface function CreateVariableValue.
else
{
ContractExpress.CreateVariableValue(_GridRowCell, "DIV", {}, VARIABLEOBJECT);
}
These two functions allow the layout to adjust (downwards) the height and width made available for the preview
document.
// Function Call : cetPreviewHeightAdjustment( string, boolean )
// Return Type : integer
A callback from Contract Express whenever the user toggles between showing the preview document and hiding
it.
17 November 2022
Embedding the Questionnaire 175
In addition to the regular style properties, such as TextAlign, the following bespoke properties are also supported
when creating HTML elements:
Icomoon
For example
InnerText
For example
InnerHTML
For example
<DIV><A>Help</A></DIV>
17 November 2022
176 Contract Express® API Manual
ClassName
For example
<DIV CLASS="StructuralTop"></DIV>
ClassExtension
For example
<SPAN CLASS="ButtonOn"></SPAN>
ContractExpress.ExtendClass(_EL, "Off");
<SPAN CLASS="ButtonOff"></SPAN>
Disabled
For example
Checked
For example
17 November 2022
Embedding the Questionnaire 177
Selected
For example
OnClickShow
Create an element such that a user click will show some other element.
For example
OnClickHide
Create an element such that a user click will hide some other element.
For example
OnClickHideThis
For example
17 November 2022
178 Contract Express® API Manual
OnClickShowHideToggle
Create an element such that a user click will toggle the visibility of some other element.
For example
TrackMouse
If it is an <IMG> element or an <INPUT> element with type IMAGE, then the SRC property of the element will be
extended:
OnMouseOver ".rollover"
OnMouseDown ".rolldown"
OnMouseUp ".enabled"
OnMouseOut ".enabled"
For example
OnMouseOver "MouseOver"
OnMouseDown "MouseDown"
OnMouseUp "MouseOver"
OnMouseOut ""
For example
17 November 2022
Embedding the Questionnaire 179
Some of the interface functions which create HTML elements actually create multiple elements.
For example, the interface function CreateQuestionProgressBar actually creates two HTML elements,
representing the bar itself plus a child HTML element representing the percentage progress. In this case, the class
name of the child element will be the class name of the bar element concatenated with the text "Meter". The
function call:
<DIV CLASS="MyQuestionProgress">
<DIV CLASS="MyQuestionProgressMeter">
</DIV>
</DIV>
Furthermore, some of the elements are volatile and their change of appearance should reflect that volatility.
<DIV CLASS="MyVariable">
...
</DIV>
When that variable is selected by the user, the class name is modified:
<DIV CLASS="MyVariableSelected">
...
</DIV>
When that variable becomes irrelevant due to other values on the questionnaire, the class name is modified again:
<DIV CLASS="MyVariableDisabledHidden">
...
</DIV>
Or
<DIV CLASS="MyVariableDisabledGhosted">
...
</DIV>
The following table lists all the helper functions which create multiple HTML elements or volatile elements,
together with their corresponding class name extensions.
17 November 2022
180 Contract Express® API Manual
17 November 2022
Embedding the Questionnaire 181
17 November 2022
182 Contract Express® API Manual
17 November 2022
Embedding the Questionnaire 183
17 November 2022
184 Contract Express® API Manual
17 November 2022
Embedding the Questionnaire 185
17 November 2022
186 Contract Express® API Manual
17 November 2022
Embedding the Questionnaire 187
The Icomoon font portrays certain characters as icons, in a similar fashion to the dingbat family of fonts.
Properties
The composite class name of the Icomoon element is determined by the Icon (example given), Disabled and
ClassName properties:
17 November 2022
188 Contract Express® API Manual
Characters
CreateElement
17 November 2022
Embedding the Questionnaire 189
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
CreateIcomoon
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The element is an icon from the Icomoon font.
See section 5.3.3 (Icomoon) above.
CreateTrace
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The element created is for debug purposes only, and will be populated with trace
information about the current questionnaire page for the current session.
CreateFinishButton
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
17 November 2022
190 Contract Express® API Manual
The default text of the element will be a localized translation of the phrase "Save &
Close".
The default text is overridden by providing a value for the parameter InnerText.
Clicking on this element will save any answers on the current questionnaire page and
terminate the session.
CreateUploadAnswersButton
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The default text of the element will be a localized translation of the phrase "Upload
Answers".
The default text is overridden by providing a value for the parameter InnerText.
Clicking on this element will offer the user a browse window for choosing a network file
which will be uploaded to the Contract Express services as answers to be merged with the
current session.
CreateDownloadAnswersButton
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The default text of the element will be a localized translation of the phrase "Download
Answers".
The default text is overridden by providing a value for the parameter InnerText.
Clicking on this element download the answers for the current session from Contract
Express services to the client browser.
CreateReadOnlyButton
17 November 2022
Embedding the Questionnaire 191
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The text of the element will be a localized translation of the phrase "Read Only".
ReadOnly
Description Returns true if-and-only-if the EditContract URL includes the name=value pair:
readonly=true
CreatePageNavigationSelector
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The tag name should be "SELECT".
The SELECT element will contain child OPTION elements for each separate questionnaire
page.
CreatePageNavigationList
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
This will contain a child element for each separate questionnaire page.
Each child element will contain an Icomoon icon to indicate its completeness, next to the
17 November 2022
192 Contract Express® API Manual
CreateQuestionProgressBar
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
A child element will be created which indicates the percentage progress through the
questionnaire.
CreateQuestionProgressMessage
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The message displayed will be determined by the total number of relevant variables in the
questionnaire, how many of those are known, and the parameters
db_completeness_display, db_completeness_format, db_completeness_threshold.
CreateQuestionProgressFigures
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
17 November 2022
Embedding the Questionnaire 193
The TABLE element will contain rows for the total number of relevant variables, the
number of complete relevant variables, and the number of incomplete relevant variables.
Of those, there are rows indicating the number of unknown values, the number of unsure
values, and the number of deferred values. The numbers themselves will be split into two
columns representing the current questionnaire page and all questionnaire pages.
CreateResizer
Description Create an HTML DIV element as the next child of the parent element.
The element will contain three child elements, the middle element of which represents a
draggable bar that resizes the proportions of the other two child elements.
A horizontal resizer arranges the outer child elements to the left and to the right of the
draggable bar.
A vertical (non-horizontal) resizer arranges the outer child elements above and below the
draggable bar.
The resizer can be initially hidden or visible.
GetParameterValue
GetLink
17 November 2022
194 Contract Express® API Manual
documents
tables
SetAlertsLocation
AllAlertsOnThisPage
Description Each object in the list represents an alert that mentions at least one variable on the
current questionnaire page.
AlertIsCompulsory
CreateAlert
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The ID of the element created is determined by the interface function
AlertMessageHostID.
17 November 2022
Embedding the Questionnaire 195
SetQuestionnaireLocation
PreviousPageExists
Description Returns true if-and-only-if a questionnaire page occurs before the current questionnaire
page.
NextPageExists
Description Returns true if-and-only-if a questionnaire page occurs after the current questionnaire
page.
NumberedPageExists
CreatePreviousPageButton
17 November 2022
196 Contract Express® API Manual
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The button element is automatically disabled whenever the interface function
PreviousPageExists returns false.
CreateNextPageButton
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The button element is automatically disabled whenever the interface function
NextPageExists returns false and db_next_button_on_last_page=disabled.
PageNumber
PageNumberTitle
Description A string of the form "M of N", where M is the current questionnaire page number and N is
the total number of questionnaire pages.
PageTitleExists
Description Returns true if-and-only-if the current questionnaire page has a title.
PageGuidanceExists
Description Returns true if-and-only-if the current questionnaire page has some guidance.
17 November 2022
Embedding the Questionnaire 197
CreatePageTitle
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The ID of the element created is determined by the interface function PageTitleHostID.
The single child element will contain the static or active text for the title of the current
questionnaire page.
The ID of the child element is determined by the interface function PageTitleTextID.
CreatePageGuidance
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The ID of the element created is determined by the interface function
PageGuidanceHostID.
The single child element will contain the static or active text for the guidance of the
current questionnaire page.
The ID of the child element is determined by the interface function PageGuidanceTextID.
CreatePageNumber
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The element will contain a localized translation of the text "M of N", where M is the
17 November 2022
198 Contract Express® API Manual
number of the current questionnaire page and N is the total number of questionnaire
pages.
AllGroupsOnThisPage
Description Each object in the list represents a group within the current questionnaire page.
GroupTitleExists
GroupGuidanceExists
CreateGroupTitle
17 November 2022
Embedding the Questionnaire 199
CreateGroupGuidance
GroupIsRepeatedGridAcross
GroupIsRepeatedGridDown
CreateRepetitionGridEditButton
17 November 2022
200 Contract Express® API Manual
CreateRepetitionGridCloseButton
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The button element enables the user to close the editing of the repeated variables and
return to its original scroll position in the questionnaire.
AllRepetitionsOfThisGroup
ActualRepetition
17 November 2022
Embedding the Questionnaire 201
This interface function is used to control whether or not the repeat title, repeat navigation
buttons and repeat management buttons appear.
CreateRepetitionTitle
CreateRepetitionNavigationButtons
CreateRepetitionManagementButtons
17 November 2022
202 Contract Express® API Manual
AllVariablesInThisRepetition
VariableIsDefinitelyRelevant
VariableIsDefinitelyIrrelevant
17 November 2022
Embedding the Questionnaire 203
VariableValueIsReadOnly
VariableIsCompulsory
VariablePreambleExists
VariablePromptExists
VariableGuidanceExists
GetVariableValueFormatted
17 November 2022
204 Contract Express® API Manual
CreateVariableBody
CreateVariableValidation
CreateVariablePreamble
17 November 2022
Embedding the Questionnaire 205
CreateVariablePrompt
CreateVariableGuidance
17 November 2022
206 Contract Express® API Manual
CreateVariableValue
SetPreviewLocation
Description Inform Contract Express where the preview document will be built.
CreatePreviewDocument
17 November 2022
Embedding the Questionnaire 207
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
It will contain a single child element and a single grand-child element.
The child element represents the border surrounding the document.
The grand-child element contains the wording of the document.
CreatePreviewToggle
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
This button element toggles between showing the preview document and hiding it.
CreatePreviewToggleHiddenSymbols
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
This button element toggles between showing/hiding space characters and end-of-line
characters in the wording.
CreatePreviewToggleExcludedText
17 November 2022
208 Contract Express® API Manual
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
This button element toggles between showing/hiding text within conditional spans that
evaluate to false.
CreatePreviewToggleBrackets
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
This button element toggles between showing/hiding the brackets surrounding
conditional text and fields.
CreatePreviewToggleSpanNumbers
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
This button element toggles between showing/hiding the sequential numbers assigned to
all the conditional spans.
CreatePreviewDocumentTabGroup
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
17 November 2022
Embedding the Questionnaire 209
The tab group contains button elements to zoom in/out the document wording, tab
between the document and any attachments, and the attachment tabs themselves.
CreatePreviewOccurrencePrevious
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The button will navigate to the previous occurrence of the selected variable in the
document wording.
CreatePreviewOccurrenceNext
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
The button will navigate to the next occurrence of the selected variable in the document
wording.
CreatePreviewOccurrenceNumber
Description Create an HTML element with the specified tag name and parameters as the next child of
the parent element.
If there are no occurrences of the selected variable in the document wording then this
element will be blank. Otherwise, it will contain the occurrence number and the total
number of occurrences.
17 November 2022
210 Contract Express® API Manual
AlertMessageHostID
AlertMessageTextID
AlertMessageIconID
PageTitleHostID
Description The identifier of the element returned by the interface function CreatePageTitle.
PageTitleTextID
Description The identifier of the element that contains the text of the page title.
PageGuidanceHostID
Description The identifier of the element returned by the interface function CreatePageGuidance.
17 November 2022
Embedding the Questionnaire 211
PageGuidanceTextID
Description The identifier of the element that contains the text of the page guidance.
GroupBodyID
GroupTitleHostID
GroupTitleTextID
GroupGuidanceHostID
GroupGuidanceTextID
17 November 2022
212 Contract Express® API Manual
GroupTitleHostID
RepetitionBodyID
RepetitionTitleHostID
RepetitionTitleTextID
RepetitionNavigationHostID
17 November 2022
Embedding the Questionnaire 213
RepetitionManagementHostID
VariableBodyID
VariablePreambleHostID
VariablePreambleTextID
VariablePromptHostID
VariablePromptTextID
17 November 2022
214 Contract Express® API Manual
VariableGuidanceHostID
VariableGuidanceTextID
VariableValueHostID
17 November 2022