Testify API Documentation
Table of contents
- 1 Overview
- 2 Fundamentals
- 3 Authentication
- 4 Pagination
- 5 Checklist Template Creation
- 6 Webhooks
- 7 Public API v2
- 7.1 External vs. Internal ID in Testify Public API v2
- 7.2 Webhooks - Example of a complete use case using Public API v2
- 7.3 Localization
- 7.4 Example for creating a custom field with a title in multiple languages
- 7.5 Attachments
- 7.6 Structure of Testify checklists in Public API v2
- 7.6.1 Entities
- 7.7 Enumeration types
- 7.8 List of Check Types (TestCase Plugins) with result and parameter structure
- 7.8.1 Logical Check - testify_booleantestcase
- 7.8.2 Calculation Check - testify_calculation_testcase
- 7.8.3 Date Check - testify_datetestcase
- 7.8.4 File Upload Check - testify_file_upload_testcase
- 7.8.5 Multi Select Check - testify_multi_selection_testcase
- 7.8.6 Numeric Check - testify_numerictestcase
- 7.8.7 Photo Upload Check - testify_photo_upload_testcase
- 7.8.8 Single Choice Check - testify_single_choice_testcase
- 7.8.9 Test Object Selection Check - testify_test_object_selection_testcase
- 7.8.10 Text Check - testify_texttestcase
- 7.8.11 Time Check - testify_timetestcase
- 7.8.12 Geoposition Check - testify_geopositioncheck
- 7.8.13 Signature Check - testify_signaturecheck
- 7.9 Add check result
- 7.9.1 Endpoints
- 7.9.2 Request Body for different Check Types
Overview
In our Technical Documentation the required information when working with the Testify API is listed.
The Testify API can be used to query information from Testify, but also to create and update information. With help of the Testify API it is easily possible to connect Testify to your own systems and exchange information in an automated way. Testify Webhooks can be used to respond on events that occur in Testify in an automated way (more information below).
The Testify API is a REST API which can be accessed via authenticated HTTP requests (using an API key). The documentation with all available endpoints can be found at https://cloud.testify.io/core/services/swagger/index.html and it is recommended to use the most recent version, which at the moment of writing this documentation is Testify API v3.0. Note that as of now all listed versions are supported, but it is not recommended to any other than v3.0 as the older versions might get deprecated in the future.
Fundamentals
HTTP Methods
Path Parameter vs. Query Parameter
The Parameters
section in swagger shows the type of the parameter.
Path Parameter
: /public/testObjects/my-testobject?api-version=3.0all path parameters are seperated by a
/
Query Paremeter
: /public/testObjects/my-testobject?api-version=3.0the first query parameter must start with an
?
all following query parameters are appended starting with an
&
Here also the three mandatory authentication HTTP headers are listed, for details see below section (Authentication).
Versioning
A version of the API contains a certain set of attributes, it is ensured that these are always available, the name of the attribute does not change and no new mandatory attributes are added in the same version. New optional fields are allowed, which can also affect the order of attributes.
Every HTTP request must contain the API version 3.0 as query parameter
e.g. ?api-version=3.0
or ?<other-parameter=value>&api-version=3.0
StageBaseUrl
The StageBaseUrl
can differ and must be adapted in the request URL (and also in the Swagger UI URL) if a private stage is used. All examples in this documentation use https://cloud.testify.io as StageBaseUrl and assume that the Testify stage is used.
Id, ExternalId, Identifier in Testify Public API v3
Id
: Internal Testify id (required, unique, guid-format)ExternalId
: Third-party-system id (optional, unique)Identifier
: Professional id (unique, human-readable)
Each entity in Testify has an (internal) id which is globally unique in the format of “00000000-0000-0000-0000-000000000000“ which is always automatically generated by the system itself if not set explicitly.
Some entities namely testobjects, testobject-types, checklists, checklist templates, checks, testequipments, testequipment-types, customfields, issue categories, groups and users additionally have an optional, unique ExternalId, which can be used for correlating to entities in another system. For example, when testobjects are synced from an ERP system, the IDs of the ERP system can be used as the ExternalId in Testify. This will make it easy later on to find the correlating test object for an entity in your ERP system by just doing an ID lookup. When creating an object without providing an externalId, it automatically gets set to the value of the internal Id.
Many entities namely testobjects, checks, testequipments, customfields and groups have an identifier property which can be used as professional unique identification of the object.
E.g. id: 9033d3c6-5897-484c-a247-61cc4e636920
, externalId: sap-object-1
, identifier: my-testobject-1
Testify entities
Checklist Template
: Defines the structure of a checklist with its pages, sections and checks.Checklist Instance
: Is an instance of a checklist template which is assigned to a certain user or group and where check results are added. A checklist instance can be created from a published checklist template.Check
&Check Result
: A checklist can contain 13 different check types of checks with different parameters and result values. Adding a check result is only possible for following kinds of check types:
Check Type | Add Check Result |
---|---|
Calculation |
|
Date |
|
FileUpload |
|
GeoPosition |
|
Logical |
|
MultipleChoice |
|
Numeric |
|
Photo |
|
Signature |
|
SingleChoice |
|
TestObjectSelection |
|
Text |
|
Time |
|
Issue
&IssueCategory
&IssueSeverity
: An issue must be categorized and must have a severtiy.TestEquipment
&TestEquipmentType
: A testequipment is a tool that is used when executing a check and it is categorized by a test equipment type.TestObject
&TestObjectType
: A testobject can be linked to a checklist instance or an issue and it is categorized by a test object type.
Authentication
To access the Testify API a Testify user with a valid API key is needed. This API key must then be sent in every requests header.
Please be aware that a user in Testify has roles and permissions and is allowed to make certain requests based on that. An API key is always generated for a certain Testify user and when making a request with an API key the permissions of that user are used. Therefore, it is advised to create an own Interface User that has all roles and permissions needed for accessing the endpoints.
Create Interface User and generate API Key
Go to https://cloud.testify.io/todos and Log In with your regular account.
Go to “Administration” → “Users” and create a new Interface User with a self defined password and all roles assigned.
Within the User’s Profile, click on the context menu and select “Generate API key”.
Note the API key that consists of secret, Subject and Tenant.
Please be aware that this API key can only be viewed once and must be regenerated otherwise. Regenerating means disabling the previous used API key.
Authenticate with API Key
Place secret, Subject and Tenant in request header.
Pagination
All /search
endpoints have a mandatory top
(integer) property, an optional skip
(integer) property and an optional count
(boolean) property in their request body.
The top property must be set to a maximum value of 80 and defines the number of elements that get sent in the response.
The skip property can be set and defines the number of elements that should be skipped.
The count property is a boolean flag which tells if the count of all elements the sent back in the response. It should be set to true when trying to query all elements and can be then used to query all the elements in batches.
Request | Response | ||||
---|---|---|---|---|---|
Number of Request | Top | Skip | Count | Value | Count |
1. | 80 | 0 | true | First 80 elements | 200 |
2. | 80 | 80 | true | Second 80 elements | 200 |
3. | 40 | 160 | true | Last 40 elements | 200 |
Checklist Template Creation
A checklist template defines the structure of a checklist with its pages, sections and checks. In Testify there is a revisioning mechanism for checklist templates, and these checklist template revisions can be in different states (Draft, Published, Disabled).
Webhooks
Webhooks allow you to respond on events that occur in Testify in an automated way, without the need to make requests repeatedly. To use webhooks a HTTP server where Testify is allowed to send POST requests is needed. When this is available, it can be easily configured within Testify on what events should be reacted to and to which URL the request should be sent to.
How to define a webhook within Testify
As logged in User go to “Administration” → “Workflows” and create a new Workflow.
Define a Name.
Define an Event.
Define an Action with scope “Webhook” and type “trigger”.
Click on “Parameters” and provide the URL of the webhook that should be called and can be accessed by Testify via
POST
request. As an optional parameter, an Identifier can be specified, which then will be sent in the request body. Also, the request timeout and the HTTP status codes that indicate success can be customized, as well as some authorization options containing of a secret and HTTP headers. Please consider thatContent-Type: application/json
andContent-Length
HTTP headers are set implicitly as default by Testify and can't be added here.Save newly created workflow, which then automatically gets invoked when the specified event occurs.
To see when a webhook has been executed and whether the execution has been successful, go to the workflow details, click on the context menu and select “History”.
Samples of what information will be sent in the webhook payload
The HTTP method is always POST and the payload depends on the event that triggered the webhook.
Property | Description |
---|---|
| This is set to the identifier that can be set as an optional parameter at the webhook configuration (see above). |
| Depending on the event that triggered the workflow these are set. |
| Id of the workflow that triggered the event. Only set if the event was triggered by a workflow. |
| Id of the tenant. |
| Gives information about the event that triggered the webhook: 1 (issue), 2 (checklist), 3 (testobject), 4 (pdf), 5 (user), or 6 (timertrigger). |
| Tells whether 1 (created) or 2 (updated) triggered the webhook. In our case a checklist has been created, so 1 is set. |
| Only set if the triggering event is an update event. Shows the values that were changed in this update. |
| External Id of the object that triggered the webhook. In our case this is the external id of the created checklist. |
| URL where details of the object that triggered the webhook can be found. In our case the created checklist can be queried via GET-request to this URL. |
| Date and time when the event took place. |
Here are some samples of sent information in the webhook payload:
Checklist created:
Issue created:
Everything looks very similar to the checklist created event, but here the
IssueFilter
is set andEntityType
is set to 1 (issue).
Issue updated:
The issue has been resolved with a duration of 5 minutes.
Note the
ChangedValues
attribute that shows thatduration
andstate
were changed. AlsoAction
has value 2 (updated) now.
Authenticated webhook requests
As mentioned above additional parameters for sending authenticated webhook requests can be specified in the webhook “Parameters”. So the target of the webhook is able to verify the integrity of an incoming webhook request. This is possible by 2 differnt mechanisms:
Adding arbitrary HTTP-Headers: This consists of key-value pairs which are then sent in the HTTP headers, e.g. Username: {Username}, Password: {Password}. Please be aware that this should only be done when using a secure channel like HTTPS, TLS.
Signing the webhook request with a pre-shared secret: This adds the following two additional HTTP headers to the webhook request -
Testify-Webhook-Signature
andTestify-Webhook-Signature-Timestamp
. TheTestify-Webhook-Signature
is a hashed value, which is created from a timestamp and the request payload by using SHA256 HMAC with the provided “secret” in the webhook parameters and then base64 encoding. Represented as:base64(HMACSHA256(TIMESTAMP + BODY))
To verify the signature, create the same SHA256 HMAC signature (containing of theTestify-Webhook-Signature-Timestamp
and the request payload) with the provided secret, then base64 encoding and compare it to theTestify-Webhook-Signature
sent in the request header. See following example:
Public API v2
External vs. Internal ID in Testify Public API v2
Many entities in Testify namely checklist templates, checklist instances, testobjects, testobject-types testequipments, testequipment-types, customfields, issue categories, groups and users have an external and an internal ID. The internal id must be a globally unique identifier in the format of “00000000-0000-0000-0000-000000000000“, whereas the external id can be in a format more readable for humans to better recognize the object and must also be unique.
E.g. internal id: 9033d3c6-5897-484c-a247-61cc4e636920
, external id: my-testobject
Users can choose an external ID to make it easy to correlate the entities to entities in other systems. For example, when testobjects are synced with an ERP system, you could reuse the IDs of the ERP system and set the external IDs in testify with that value. That will make it easy later on to find the correlationg test object for an entity in your ERP system by just doing an ID lookup.
Where does the Testify Public API v2 use External IDs?
In General, all IDs used by the Testify Public API v2 are external IDs.
What happens when no External ID is provided when creating objects?
An internal ID is always automatically generated by the system itself. The external ID can be chosen when creating the entity via the API v2 by just assigning a value to the ID property. This value has to be unique, though. When creating an object without providing an external ID, it automatically gets set to the value of the generated internal ID.
Webhooks - Example of a complete use case using Public API v2
This example shows a complete use case using Testify API v2. First a testobject is created and for this testobject a checklist is instantiated. When the checklist is completed in Testify two webhooks are called, one that fetches the check results and one that informs us about a generated PDF for that checklist and downloads it.
Create testobject via Testify API v2:
Send POST-request
Endpoint: {
StageBaseUrl
}/public/testobjects?api-version=2.0HTTP method: POST
HTTP headers: API key (secret, Subject, Tenant), Content-Type: application/json, Content-Length
Payload (approach 1): Both the internal id and the external id are automatically set by the system and are the same.
OR Payload (approach 2) including self-assigned external id: The external id is set to
my-testobject
and the internal id is automatically set by the system.
Testobject has successfully been created if response has statuscode 200 OK and payload contains external id of new testobject. If response statuscode is 400 Bad Request something in the request is wrong, but error details are provided in the payload.
Instantiate checklist for newly created testobject via Testify API v2:
Send POST-request:
Endpoint: {
StageBaseUrl
}/public/checklists?api-version=2.0HTTP method: POST
HTTP headers: API key (secret, Subject, Tenant), Content-Type: application/json, Content-Length
Payload (approach 1):
testObjectId
contains the external id of the above created testobject.OR Payload (approach 2) including self-assigned external id:
Checklist has successfully been started when response has statuscode 200 OK and payload contains external id of new checklist instance. If response statuscode is 400 Bad Request something in the request is wrong, but error details are provided in the payload.
React to webhook informing us of completed checklist and fetch check results:
Prerequisites 1 - Before completing the checklist: Configure webhook that should be triggered (see above).
Event details: Scope: “Checklist”, Type: “updated”, Triggers: State = “Done”
Action details: Scope “Webhook”, Type: “trigger”, provide URLParse Webhook payload:
ChangedValues
shows state change from 0 (open) to 3 (done) and new modifiedAt date.EntityId
is needed to fetch the checklist results.
Send GET-Request to fetch checklist results:
Endpoint: {
StageBaseUrl
}/public/checklists/{EntityId
}/results/flat?api-version=2.0HTTP method: GET
HTTP headers: API key (secret, Subject, Tenant)
Payload: no payload
The response should have status code 200 OK and gives details of the checklist instance with all testcases. Details to this response can be found below at “Structure of checklist results” section.
React to webhook informing us of generated PDF for checklist and download it:
Prerequisites 1 - Before completing the checklist: Configure workflow that automatically generates PDF.
Event details: Scope: “Checklist”, Type: “updated”, Triggers: State = “Done”
Action details: Scope: “PDF”, Type: “generate”, select PDF protocol profile and language
Prerequisites 2 - Before completing the checklist: Configure webhook that should be triggered.
Event details: Scope: “PDF”, Type: “Checklist PDF generated”
Action details: Scope “Webhook”, Type: “trigger”, provide URLParse Webhook payload:
EntityUrl
is needed to get created PDF.
Send GET-Request to get created PDF and download it:
Endpoint:
EntityUrl
HTTP method: GET
HTTP headers: no headers
Payload: no payload
The response should have status code 200 OK and gives the created PDF as payload.
Localization
All localizations implemented in Testify can also be used in the Testify API v2. Every tenant has a default language which normally is English (US). Following languages are available:
Iso-Code | Title |
---|---|
bs | Bosanski |
de-AT | Deutsch |
en-GB | English (UK) |
en-IN | English (India) |
en-US | English (US) |
es-MX | Español |
fr | Français |
nl | Nederlands |
pt-BR | Português |
ru | русский |
zh-CN | 中文(中国) |
zh-TW | 中文(台灣) |
Example for creating a custom field with a title in multiple languages
Send POST-Request:
Endpoint: {
StageBaseUrl
}/public/customfields?api-version=2.0HTTP method: POST
HTTP headers: API key (secret, Subject, Tenant), Content-Type: application/json, Content-Length
Payload:
The
label
contains the respective iso code with the localized content and the default language must always be provided.
The response should have status code 200 OK and gives the custom field key of the newly created custom field.
Attachments
Testobject attachments can be uploaded via the POST /attachments/testobject/{externalId} endpoint and the request body must have following format:
Structure of Testify checklists in Public API v2
Entities
Checklist Template
: Defines the structure of a checklist with its pages, sections and checks.Checklist Template Revision
: Is a revisioning mechanism for checklist templates. A checklist template revision can be in different states (see Enumeration types below).Checklist Instance
: Is an instance of a checklist template which is assigned to a certain user or group and where check results are added. A checklist instance can be created from a checklist template´s current (published) revision.Check
(Testcase): A checklist can contain 11 different types of checks with different parameters and result values (see details below).
Enumeration types
Many endpoints use enumeration types in their request or response body. In the Testify API v2 they are represented by their integer value. Some important examples are listed below:
Checklist Template Revision State (revisionState)
Checklist Instance State
Testcase Result Value Type
Testcase Plugin Parameter Type
List of Check Types (TestCase Plugins) with result and parameter structure
The result type always refers to the TestCase Result Value Type
and the parameter type always refers to TestCase Plugin Parameter Type
(see above, with examples about how the value can look like)
Testify offers 13 different check types (internally called TestCase Plugins). The different check types contain different types of data which are described in this section.
Logical Check - testify_booleantestcase
Calculation Check - testify_calculation_testcase
Date Check - testify_datetestcase
File Upload Check - testify_file_upload_testcase
Multi Select Check - testify_multi_selection_testcase
Numeric Check - testify_numerictestcase
Photo Upload Check - testify_photo_upload_testcase
Single Choice Check - testify_single_choice_testcase
Test Object Selection Check - testify_test_object_selection_testcase
Text Check - testify_texttestcase
Time Check - testify_timetestcase
Geoposition Check - testify_geopositioncheck
Signature Check - testify_signaturecheck
Add check result
Endpoints
There are two endpoints where check results can be added. They differ in whether the checkId
or the checkIdentifier
ist set. Both - checkId
and checkIdentifier
- can be queried at the GET /public/checklists/{externalId}/results/flat
endpoint. (which is described above)
POST
/public/checklists/checkresult
: Add check result by checkId.POST
/public/checklists/checkresult/identifier
: Add check result by human-readable checkIdentifier.