Quick Start |
Scroll |
Welcome to Thereforeā¢ Web API! It supports both SOAP and JSON/REST standards. This getting started article will help you to create your first JSON/REST requests. For SOAP requests please check the following page for information (WSDL, URLs).
The steps to do so are the following:
o Step 1. Archive a document with index data (CreateDocument)
o Step 2. Find documents in a category by index data (ExecuteSingleQuery)
o Step 3. Retrieve a document with index data (GetDocument)
This tutorial assumes you have Thereforeā¢ Server up and running and Web API server is enabled. For how to check an configure Thereforeā¢ Web API server see this page. If you are using Thereforeā¢ Online the Web API server is already enabled and ready to use.
We will use Postman to make API calls. You can install it from here https://www.postman.com/.
Find out and prepare the following to be ready for the next steps:
oIf you are connecting to a multitenant Thereforeā¢ system tenant name will be needed.
oBuild a base URL for your requests by using the following templates
For an on-premise system:
http(s)//<server_name>:<port_number>/theservice/v0001/restun
Example:
https://myserver.com/theservice/v0001/restun
For Thereforeā¢ Online:
https//<tenant_name>.thereforeonline.com/theservice/v0001/restun
Example:
https://mytenant.thereforeonline.com/theservice/v0001/restun
oCredentials. In this tutorial we will use endpoint which accepts basic HTTP credentials. You will need user name and password. There are also Windows authentication endpoints available (see /restwin, /soapwin).
oUse Therefore Solution Designer to create a category with text and number fields. Write down numbers of the category and the fields. You will need it later.
oStart Postman and create a new collection
oConfigure the collection: add authorization and baseUrl variable (to be used in all the requests in this collection) and save the changes.
Authorization:
baseUrl variable:
oIn the following steps you will add new requests to the collection as shown below
oIf you make request to a multitenant system add tenant name in HTTP headers as shown below for every request. Here you can find list of the other HTTP headers supported by Web API.
Step 1. Archive a document with index data
Add a new CreateDocument POST request to your collection to create a document with index data specified. Use category and field numbers you found in Thereforeā¢ Solution Designer earlier. Send the request.
For archiving files check the Archiving Files to Documents section.
Example:
Step 2. Find documents in a category by index data
To work with a document (to update/delete/etc. it) you need its' number (DocNo). A common way to get document number is by doing search.
To find a document by index data we are going to use ExecuteSingleQuery Web API method. There are other search methods available (for full text search, etc.).
Below is an example of such query. You specify a category or case definition number, and conditions for one or more fields.
Notice values 13, 5 in the SelectedFieldsNoOrNames array in the request. These are numbers of Thereforeā¢ internal fields you can get in the result.
Example:
Step 3. Retrieve a document with index data
All the methods to work with Therefore documents are listed in Document Operations section. Please check it later.
So.. to retrieve a document you can use GetDocument method as shown in the example below.
Example:
Next steps
When finished check the other topics you can find in this documentation:
▪Retrieving Files from Documents
▪Working with Document Streams
and more..