Query API
Introduction
With the TMT version 5.0 release, we introduced a new query mode to retrieve document related data from the server. This will replace the existing RPC operations for receiving document related data, for example: LIST_DOCUMENT or LIST_LINKS.
First step
To perform a query, you need to send a RPC Request with operation QUERY.
Simple example of a QUERY request:
{
"id": "FIRST_STEP",
"jsonrpc": "2.0",
"method": "QUERY",
"params": {
"query": {
"targetDocumentModel": "TestCase-dm",
"projectionName": "document",
"paging": {
"pageSize": 10,
"pageNumber": 0
}
}
}
}
| Parameter | Required | Description |
|---|---|---|
targetDocumentModel | ✓ | Document Model name for which the query should be performed. |
projectionName | ✓ | Specifies which projection type should be used for the query. Pre-defined are "document", "cdd", and "document-graph" as projection names. |
paging | ✓ | Specifies the pagination of the query result. |
sort | Specifies the sorting of the query result documents. Data Services does not apply any sorting per default. | |
constraint | Restricts the query result based on operators (e.g. logic operators on Document Model fields). | |
fields | Specifies which Document Model fields should be included in the query result. If not explicitly provided, all fields are included. | |
links | Specifies which link documents should be included in the query result. | |
aggregation | Specifies a function which can be applied to the query result. Supported functions are "avg", "count", "min", "max", and "sum". | |
exclude | Specifies whether root documents should be excluded from the query result. This is useful when only link documents are required. |
Query API Example
Simple Example of Query list of test cases
Load a list of test cases by given query parameters.
Authorizations:
header Parameters
| Project-Id required | string Project Id or the project document reference |
| Subproject-Id | string Sub Project Id or the project document reference. It might be required if you want to access the sub project's resource |
Request Body schema: application/jsonrequired
| id required | string id of the operation |
| jsonrpc required | string must be 2.0 |
| method required | string QUERY |
required | object |
Responses
Request samples
- Payload
{- "id": "FIRST_STEP",
- "jsonrpc": "2.0",
- "method": "QUERY",
- "params": {
- "query": {
- "targetDocumentModel": "TestCase-dm",
- "projectionName": "document",
- "paging": {
- "pageSize": 10,
- "pageNumber": 0
}
}
}
}Response samples
- 200
{- "jsonrpc": "2.0",
- "id": "FIRST_STEP",
- "result": {
- "fullSize": 9073,
- "page": {
- "pageNumber": 0,
- "pageSize": 3
}, - "entries": [
- {
- "docRef": "TestCase-dm/003c8e4f-2ee6-453e-8150-0e7ea23491b9",
- "document": {
- "Root": {
- "AdditionalInfo": {
- "CreatingEvent": "USER_MANUALLY",
- "TriggeredAt": 1774411978857,
- "TriggeredBy": "tmtdev"
}, - "Conditions": {
- "Preconditions": "Precondition"
}, - "Criteria": {
- "TimeRelevance": false
}, - "General": {
- "Description": "",
- "HasAssignee": false,
- "Id": "C_271",
- "ImportantAdditionForNextTestRun": true,
- "ProjectId": "P_147",
- "ProjectVersionNumber": "1.0.0",
- "Status": "NEW",
- "SubprojectId": "SP_1",
- "TechnicalId": "22129d20-8a0f-442c-9409-f6f670b2337d",
- "TenantId": "T_1",
- "TestSuiteId": "S_11",
- "Title": "Candidate GER-TP&SP | Apprenticeship - NationalCitizen | Submit external candidate information with mandatory data"
}, - "Metadata": {
- "CreatedBy": "mba.tenantadmin",
- "CreatedOn": 1774411978860,
- "DisplayCreatedOn": "2026-03-25T04:12:58",
- "DisplayEditedOn": "2026-03-25T08:06:15",
- "EditedBy": "mba.tenantadmin",
- "EditedOn": 1774425975992,
- "AssignedToVersion": { }
}, - "Risk": {
- "AutoCalculateImpact": true,
- "AutoCalculateLikelihood": true,
- "Impact": null,
- "Likelihood": "UNLIKELY",
- "ReleaseScope": { },
- "TestHistory": { }
}, - "TestSteps": [
- {
- "Action": "sional degree]` |\n\n### Insurances — Social security\n\n| Field | Input value |\n|---|---|\n| Do you already have a social security number? | yes *(initial value = true)* |\n| Social security no. | `[social security no.]` |\n\n### Insurances — Health insurance\n\n| Field | Input value |\n|---|---|\n| Health insurance based in Germany? | yes *(initial value = true)* |\n| Type of health insurance | `[type of health insurance]` |\n| Health insurance | `[health insurance]` |\n| Copy membership | leave empty |\n\n### Insurances — Pension insurance\n\n| Field | Input value |\n|---|---|\n| Pension insurance compulsory? | no *(initial value = false)* |\n\n### Multi-Employment\n\n| Field | Input value |\n|---|---|\n| Is there multiple employment present? | no *(initial value = false)* |\n\n### Tax\n\n| Field | Input value |\n|---|---|\n| Tax identification no. | `[tax identification no.]` |\n| Tax class | `[tax class]` |\n| Faktorverfahren (payroll germany) | leave empty |\n| Church tax | yes |\n| Denomination | `[denomination]` |\n\n### Apprenticeship\n\n| Field | Input value |\n|---|---|\n| Apprentice was of legal age at time of contract signing | yes *(initial value = true)* |\n| Which subject would you like to attend? | `[vocational school subject]` |\n\n### Onboarding Preparations\n\n| Field | Input value |\n|---|---|\n| Is a job ticket required? | no *(initial value = false)* |",
- "ExpectedResult": "All entered fields display correct values and are enabled",
- "Id": "05faeae6-505d-4ae0-ba7c-def4f044b740",
- "No": 1
}, - {
- "Action": "Click on **\"SUBMIT →\"** button",
- "ExpectedResult": "- Displays notification: *external candidate information submitted successfully*\n- All fields become disabled\n- Information is displayed and disabled as below:\n\n### Personal information\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Maiden name | empty |\n| German citizenship? | yes |\n| Nationality | German |\n| Nationality in local language | Deutsch |\n| Place of birth | `[place of birth]` |\n| Marital status | `[marital status]` |\n| Copy ID / passport | `[copy ID / passport]` |\n\n### Disability\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Does a disability exist? | no |\n\n### Children\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Do you have children? | no |\n\n### Emergency contact\n\n| Field | Value displayed (disabled) |\n|---|---|\n| First name | `[emergency first name]` |\n| Last name | `[emergency last name]` |\n| Contact info | `[emergency contact info]` |\n| Additional info | `[emergency additional info]` |\n\n### Bank\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Name of bank | empty |\n| Account owner | empty |\n| IBAN | `[IBAN]` |\n| BIC / SWIFT | `[BIC / SWIFT]` |\n| Account no. | empty |\n| Bank code | empty |\n\n### Education\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Highest school degree | `[highest school degree]` |\n| Highest degree of professional education | `[highest professional degree]` |\n\n### Insurances — Social security\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Do you already have a social security number? | yes |\n| Social security no. | `[social security no.]` |\n\n### Insurances — Health insurance\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Health insurance based in Germany? | yes |\n| Type of health insurance | `[type of health insurance]` |\n| Health insurance | `[health insurance]` |\n| Copy membership | empty |\n\n### Insurances — Pension insurance\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Pension insurance compulsory? | no |\n\n### Multi-Employment\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Is there multiple employment present? | no |\n\n### Tax\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Tax identification no. | `[tax identification no.]` |\n| Tax class | `[tax class]` |\n| Faktorverfahren (payroll germany) | empty |\n| Church tax | yes |\n| Denomination | `[denomination]` |\n\n### Apprenticeship\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Apprentice was of legal age at time of contract signing | yes |\n| Which subject would you like to attend? | `[vocational school subject]` |\n\n### Onboarding Preparations\n\n| Field | Value displayed (disabled) |\n|---|---|\n| Is a job ticket required? | no |",
- "Id": "d77a57e0-9707-43f7-86ab-2a134b9ec4f3",
- "No": 2
}
]
}, - "__meta": {
- "createdAt": "2026-03-25T04:12:58",
- "creator": "mba.tenantadmin",
- "docRef": "TestCase-dm/003c8e4f-2ee6-453e-8150-0e7ea23491b9",
- "modelReference": "TestCase-dm",
- "modelVersion": null,
- "modifiedAt": "2026-03-25T08:06:15",
- "modifier": "mba.tenantadmin"
}
}, - "type": "ROOT",
- "depth": 0,
- "documentModelName": "TestCase-dm"
}, - {
- "docRef": "TestCase-dm/00681c2a-7c36-4b43-9d75-d75f9cd0419c",
- "document": {
- "id": "-1",
- "Root": {
- "AdditionalInfo": {
- "CreatingEvent": "USER_MANUALLY",
- "TriggeredAt": 1776614774233,
- "TriggeredBy": "mba.tenantadmin"
}, - "Conditions": {
- "Preconditions": "- Browser is open at the int-devee URL\n- Log in by `[HR account]` of `[company]` with confidential mode\n- The **\"Employees\"** screen is open\n- The employee form is open on the **Contracts** tab\n- A contract draft is open; the **Hours and Absences** section is being filled\n- **Hours of work per week** is set to `40:00`"
}, - "Criteria": {
- "TimeRelevance": false
}, - "General": {
- "Description": "",
- "HasAssignee": false,
- "Id": "C_777",
- "ImportantAdditionForNextTestRun": true,
- "ProjectId": "P_147",
- "ProjectVersionNumber": "1.0.0",
- "Status": "NEW",
- "SubprojectId": "SP_1",
- "TechnicalId": "c060408a-e840-4c98-aa8b-db690fde7cf0",
- "TenantId": "T_1",
- "TestSuiteId": "S_26",
- "Title": "Contract draft - Hours distribution daily sum must equal hours of work per week (2)"
}, - "Metadata": {
- "CreatedBy": "mba.tenantadmin",
- "CreatedOn": 1776614774236,
- "DisplayCreatedOn": "2026-04-19T16:06:14",
- "DisplayEditedOn": "2026-04-19T16:06:14",
- "EditedBy": "mba.tenantadmin",
- "EditedOn": 1776614774236
}, - "Risk": {
- "AutoCalculateImpact": true,
- "AutoCalculateLikelihood": true
}, - "TestSteps": [
- {
- "Action": "Click **\"ADD\"** in the Hours and Absences section and fill in the following fields:\n- Valid from: `[contract start date]`\n- Working time model: `Full-time`\n- Hours of work per week: `40:00`",
- "ExpectedResult": "All fields are accepted and values are displayed correctly.",
- "Id": "04be5073-3827-4807-bebd-1fa7568260fe",
- "No": 1
}, - {
- "Action": "Add distribution of work rows with hours that sum to less than 40:00:\n\n| Week day | Hours per day |\n|---|---|\n| Monday | 08:00 |\n| Tuesday | 08:00 |\n| Wednesday | 08:00 |\n| Thursday | 08:00 |\n\n(total = 32:00, not 40:00) Then click **\"APPLY AND RETURN\"**.",
- "ExpectedResult": "A validation error is displayed indicating the daily hours do not sum to 40:00.",
- "Id": "11e29a50-bb94-453c-ad6f-adc0464761cb",
- "No": 2
}, - {
- "Action": "Add Friday with `08:00` so the total equals 40:00, then click **\"APPLY AND RETURN\"**.",
- "ExpectedResult": "No validation error is displayed; the record is saved successfully.",
- "Id": "6e429c75-57e9-4d7d-b1cf-b243d711b9dc",
- "No": 3
}, - {
- "Action": "Edit the distribution to add a 6th day entry or change one day's hours so the total exceeds 40:00, then attempt to save.",
- "ExpectedResult": "A validation error is displayed again indicating the daily hours do not sum to 40:00.",
- "Id": "6de4065b-0eac-4b33-a001-b6ec36e248d3",
- "No": 4
}, - {
- "Action": "Set all 5 days to 08:00 (total = 40:00), then click **\"APPLY AND RETURN\"**.",
- "ExpectedResult": "Record saves successfully; the row is displayed in the Hours and Absences table:\n\n| Valid from | Working time model | Hours of work per week |\n|---|---|---|\n| `[contract start date]` | `Full-time` | `40:00` |",
- "Id": "0cc81161-0c34-4052-a970-0ca7c65fc01c",
- "No": 5
}
]
}, - "__meta": {
- "createdAt": "2026-04-19T16:06:14",
- "creator": "mba.tenantadmin",
- "docRef": "TestCase-dm/00681c2a-7c36-4b43-9d75-d75f9cd0419c",
- "modelReference": "TestCase-dm",
- "modelVersion": null,
- "modifiedAt": "2026-04-19T16:06:14",
- "modifier": "mba.tenantadmin"
}
}, - "type": "ROOT",
- "depth": 0,
- "documentModelName": "TestCase-dm"
}, - {
- "docRef": "TestCase-dm/9705f4eb-d71d-4d4e-9d5a-ca5715517074",
- "document": {
- "Root": {
- "AdditionalInfo": {
- "CreatingEvent": "NEW_VERSION_CREATED",
- "TriggeredAt": 1724340198020,
- "TriggeredBy": "demo.user",
- "SourceTestCaseInfo": {
- "Id": "C_9",
- "ProjectId": "P_1",
- "ProjectVersionNumber": "1.0.0",
- "SubprojectId": "_",
- "TenantId": "T_1"
}
}, - "Attachments": [
- {
- "CopyNumber": 0,
- "CreatedAt": "2024-08-22T15:38:10",
- "FileName": "DALL·E 2024-08-22 17.38.04 - An image depicting the product details page of the ACME Web Shop. The page should display a product, such as a 'Smartphone,' with its main features cl.webp",
- "OriginalFileName": "DALL·E 2024-08-22 17.38.04 - An image depicting the product details page of the ACME Web Shop. The page should display a product, such as a 'Smartphone,' with its main features cl.webp",
- "Referenced": false,
- "ThumbnailId": "1c61a86e-23db-4b08-bc80-0ebeb57536d8",
- "UploadBy": "demo.user",
- "UploadOn": "2024-08-22",
- "File": {
- "attachment_id": "d6717ea5-3def-4427-972e-5407fbcb8d5d",
- "content": null,
- "internal_filename": "1724341089200-bd2c9f6f-ecbe-4f20-9681-c1dde4a19afc.webp",
- "mime_type": "image/webp",
- "original_filename": "DALL·E 2024-08-22 17.38.04 - An image depicting the product details page of the ACME Web Shop. The page should display a product, such as a 'Smartphone,' with its main features cl.webp",
- "size": 296688
}
}
], - "Conditions": {
- "Preconditions": "The user is on the product listing page."
}, - "Criteria": {
- "TimeRelevance": false
}, - "General": {
- "Automation": "TO_BE_AUTOMATED",
- "Description": "Verify that a user can view detailed information about a product.",
- "EstimatedExecutionTime": 10,
- "HasAssignee": false,
- "Id": "C_9",
- "ImportantAdditionForNextTestRun": true,
- "Prioritization": "MANDATORY",
- "ProjectId": "P_1",
- "ProjectVersionNumber": "1.1.0",
- "Status": "DONE",
- "SubprojectId": "_",
- "TechnicalId": "5c9d667b-7046-4e00-8784-02164347a7af",
- "TenantId": "T_15",
- "TestSuiteId": "S_2",
- "Title": "View Product Details",
- "Type": "FUNCTIONAL"
}, - "Metadata": {
- "CreatedBy": "demo.user",
- "CreatedOn": 1731512382387,
- "DisplayCreatedOn": "2024-11-13T15:39:42",
- "DisplayEditedOn": "2024-11-13T15:39:42",
- "EditedBy": "demo.user",
- "EditedOn": 1731512382387,
- "IsFrozenByClosedTestRun": true,
- "IsImported": false,
- "AssignedToVersion": { },
- "LatestTestCaseExecutionData": {
- "TestCaseId": null,
- "TestCaseTitle": null,
- "TestRunId": "R_1",
- "TestedOn": "2024-08-22T15:18:31"
}
}, - "Risk": {
- "CombinationLikelihoodImpact": "null__null"
}, - "TestSteps": [
- {
- "Action": "Click on a product from the listing.",
- "ExpectedResult": "The product details page is displayed.",
- "Id": "b5d4ec8d-2815-4e82-8235-de8500e2c7bf",
- "No": 1
}, - {
- "Action": "Check the product details.",
- "ExpectedResult": "The page includes product name, price, description, images, and reviews.",
- "Id": "183ada04-3748-4f5b-a591-4bb3791da4ed",
- "No": 2
}
]
}, - "__meta": {
- "createdAt": "2024-11-13T15:39:42",
- "creator": "SYSTEM",
- "docRef": "TestCase-dm/9705f4eb-d71d-4d4e-9d5a-ca5715517074",
- "modelReference": "TestCase-dm",
- "modelVersion": null,
- "modifiedAt": "2024-11-13T15:39:42",
- "modifier": "SYSTEM"
}
}, - "type": "ROOT",
- "depth": 0,
- "documentModelName": "TestCase-dm"
}
], - "links": [ ],
- "otherResults": { }
}
}Parameters details
sort Parameter
Defines the sorting behavior for the query result. It is possible to define the sorting based on multiple fields.
| Parameter | Required | Description |
|---|---|---|
field | ✓ | Specifies the Document Model field path for which the query result should be sorted. |
direction | ✓ | Specifies the order for the sorting of the query result. Options are "ASC" for ascending and "DESC" for descending. |
nullHandling | ✓ | Specifies how null values should be handled for the sorting. Options are "NULLS_FIRST" and "NULLS_LAST". |
ignoreCase | ✓ | Specifies if the sorting should be case-insensitive. Options are true or false. |
Example: the query result entries will be sorted by the ID in descending order
"sort": [
{
"field": "/Root/General/Id",
"direction": "DESC",
"nullHandling": "NULLS_LAST",
"ignoreCase": false
}
]
It is recommended to use the "NULLS_LAST" option because it is more efficient in terms of performance.
paging Parameter
Pagination starts counting from the index 0. This means the first query result entries are available on the page with the number 0.
| Parameter | Required | Description |
|---|---|---|
pageNumber | ✓ | Specifies the page number to retrieve document data of the query result. |
pageSize | ✓ | Specifies the amount of entries for each query result page. |
"paging": {
"pageSize":5,
"pageNumber":1
}
constraint Parameter
| Parameter | Required | Description |
|---|---|---|
operator | ✓ | Specifies the kind of operator to be used. Field-aware operators: exact_match, simple_search, undefined_match, double_range, date_range, datefragment_range. Logic operators: and, or, not. Has operator: has. |
operands | Specifies an entity as an input for a search term. Some operators allow for combining multiple operands. It is possible to define any nested conditional structures. |
Example:
"constraint": {
"operator":"and",
"operands":[
{
"operator": "exact_match",
"field": "/Root/General/ProjectId",
"value": "P_1"
},
{
"operator": "exact_match",
"field": "/Root/General/SubprojectId",
"value": "SP_1"
},
{
"operator": "not",
"operand": {
"operator": "exact_match",
"field": "/Root/General/TestSuiteId",
"value": "SP_1"
}
},
{
"operator": "simple_search",
"fields": [
"/Root/General/Title"
],
"value": "Release today"
},
{
"operator": "date_range",
"field": "/__meta/createdAt",
"from": "2026-04-01T00:00:00",
"to": "2026-04-01T23:59:59"
}
]
}
The above constraint is Simplified
Root.General.ProjectId = "P_1" AND Root.General.SubprojectId = "SP_1" AND Root.General.TestSuiteId != "SP_1"
Supported operators are:
- And Operator
- operator: "and"
- operands: list of constraints which will be combined with the AND operator
- Or Operator
- operator: "or"
- operands: list of constraints which will be combined with the OR operator
- Not Operator
- operator: "not"
- operand: a single constraint which will be negated with the NOT operator
{
"operator": "not",
"operand": {
"operator": "exact_match",
"field": "/Root/General/TestSuiteId",
"value": "SP_1"
}
}
- Has Operator
- operator: "has"
- relationshipModel: Specifies the Relationship Model, which document data shall be retrieved for.
- targetRole: Specifies the target role in the relationship that will be linked to the root document. Data Services differentiates for document types
"ROOT","CHILD"and"LINK". - constraint: Defines a condition on the target document of the relationship, which allows for filtering of the link documents.
- linkDocumentConstraint: Defines a condition on the link document, which allows for filtering the list of links. This is only allowed when a Link Document Model is defined for the relationship.
- maxDepth: Relevant for self-referencing relationships. Specifies how many references will be resolved. Required when a self-referencing relationship is detected in a link during query validation.
- Date RangeOperator
- operator: "date_range"
- field: Specifies the Document Model field path for which the date range operator should be applied.
- from: Specifies the start date for the date range operator. The date needs to be provided in ISO 8601 format (e.g. "2026-04-01T00:00:00").
- to: Specifies the end date for the date range operator. The date needs to be provided in ISO 8601 format (e.g. "2026-04-01T23:59:59").
{
"operator": "date_range",
"field": "/__meta/createdAt",
"from": "2026-04-01T00:00:00",
"to": "2026-04-01T23:59:59"
}
- Date Fragment Range Operator
- operator: "datefragment_range"
- field: Specifies the Document Model field path for which the date fragment range operator should be applied.
- from: Specifies the start date fragment for the date fragment range operator. The date fragment needs to be provided in the format "datepart:datevalue" (e.g. "year:2024").
- to: Specifies the end date fragment for the date fragment range operator. The date fragment needs to be provided in the format "datepart:datevalue" (e.g. "year:2024").
- Double Range Operator
- operator: "double_range"
- field: Specifies the Document Model field path for which the date fragment range operator should be applied.
- from: Specifies the start date fragment for the date fragment range operator. The date fragment needs to be provided in the format "datepart:datevalue" (e.g. "year:2024").
- to: Specifies the end date fragment for the date fragment range operator. The date fragment needs to be provided in the format "datepart:datevalue" (e.g. "year:2024").
- Exact Match Operator: Represents an EXACT MATCH search operator. Returns all results that have fields with value that matches exactly the input value.
- operator: "exact_match"
- field: Specifies the Document Model field path for which the exact match operator should be applied.
- value: Specifies the value for which the exact match operator should be applied.
- caseSensitive?: Specifies if the exact match operator should be case-sensitive. Options are
trueorfalse. The default value isfalse.
{
"operator": "exact_match",
"field": "/Root/General/ProjectId",
"value": "P_1"
}
- UndefinedMatchOperator: Represents the UNDEFINED_MATCH operator that checks if a given field has value
nullor if it is not present.- operator: "undefined_match"
- field: Specifies the Document Model field path for which the undefined match operator should be applied.
- value: Specifies whether the field value is defined or not. Options are
true(field value is defined) orfalse(field value is not defined).
- SimpleSearchOperator:
- Represents a SIMPLE SEARCH search operator.
- Return all documents which have fields with a value that contains the input string.
- This operator can be applied on types:
- StringType
- parameters:
- operator: "simple_search"
- fields: Specifies the Document Model field path for which the simple search operator should be applied.
- value: Specifies the value for which the simple search operator should be applied.
{
"operator": "simple_search",
"fields": [
"/Root/General/Title"
],
"value": "Release today"
}
fields Parameter
The fields parameter is part of the projection for the query result. It allows to specify the data fields which should be returned. All other Document Model fields will be ignored. Providing this parameter improves performance and reduces the result payload.
Example:
"fields":[
"/Root/General/Id",
"/Root/General/Title"
]
In the above example, only the fields "Id" and "Title" of the Document Model will be included in the query result. All other fields will be ignored.
links Parameter
The links parameter allows selecting additionally related documents in a relationship next to the query root documents. It is possible to define constraints for the link documents, which allows the filtering of such.
| Parameter | Required | Description |
|---|---|---|
relationshipModel | ✓ | Specifies the Relationship Model, which document data shall be retrieved for. |
targetRole | ✓ | Specifies the target role in the relationship that will be linked to the root document. Data Services differentiates for document types "ROOT", "CHILD" and "LINK". |
constraint | Defines a condition on the target document of the relationship, which allows for filtering of the link documents. | |
linkDocumentConstraint | Defines a condition on the link document, which allows for filtering the list of links. This is only allowed when a Link Document Model is defined for the relationship. | |
fields | Specifies which fields of the "CHILD" documents should be included in the query result. If not explicitly provided, all fields are included. | |
linkDocumentFields | Specifies which fields of the "LINK" documents should be included in the query result. If not explicitly provided, all fields are included. | |
links | Allows for linking additional documents to the link documents. It is possible to define either recursive or nested structures. | |
maxDepth | Relevant for self-referencing relationships. Specifies how many references will be resolved. Required when a self-referencing relationship is detected in a link during query validation. |
See the following example for the links parameter:
"params": {
"query": {
"targetDocumentModel": "TestRun-dm",
"projectionName": "document",
"paging": {
"pageSize": 50,
"pageNumber": 0
},
"links": {
"relationshipModel": "TestRunTestCase-rm",
"targetRole": "TestCase",
"fields": [
"/Root/General/Title",
"/Root/General/Id",
"/__meta/docRef"
],
"constraint": {
"operator": "exact_match",
"field": "/Root/General/ProjectId",
"value": "P_6"
},
"linkDocumentFields": [
"/Root/General/Id",
"/Root/General/Result",
"/__meta/docRef"
],
"maxDepth": 1
}
}
}
In the above example,
- The query is performed for the Document Model "TestRun-dm".
- For each TestRun document in the query result, linked TestCase documents will be included in the query result based on the relationship model "TestRunTestCase-rm" and the target role "TestCase".
- Only the fields "Title", "Id", and the document reference field will be included for the linked TestCase documents in the query result.
- Additionally, only those TestCase documents will be included in the query result which have the value "P_1" in the field "ProjectId".
- For the link documents, only the fields "Id", "Result", and the document reference field will be included in the query result.
Aggregation Parameter
| Parameter | Required | Description |
|---|---|---|
aggregations | ✓ | List of different aggregation operations. |
function | ✓ | Specifies the type of operation to be processed. Options are "avg", "min", "max", "sum" and "count". |
field | ✓ | Specifies the Document Model field for which the aggregation should be processed or grouped. |
group | ✓ | Collect the aggregation results and group them based on a field. |
{
"aggregation": {
"aggregations": [
{
"function": "count",
"field": "/Root/General/Id"
}
],
"group": [
{
"field": "/Root/General/ProjectId"
}
]
}
}
In the example above, the test cases are counted and then grouped by ProjectId.
Migration from FilterSpec
The old filter spec used in the LIST_DOCUMENT can be migrated to Query API constraints as follows:
Old Filter spec
"filters": [
"Root.General.TenantId:T_1",
"Root.General.ProjectId:P_98",
"Root.General.SubprojectId:_",
"Root.General.Id:C_1",
"Root.General.Title:test",
"~Root.General.Title:test",
"-Root.General.Title:test",
"Root.General.Id:(C_1 OR C_2 OR C_3)",
]
New Query API constraint:
"constraint": {
"operator": "and",
"operands": [
// "Root.General.TenantId:T_1"
{
"operator": "exact_match",
"field": "/Root/General/TenantId",
"value": "T_1"
},
// "Root.General.ProjectId:P_98"
{
"operator": "exact_match",
"field": "/Root/General/ProjectId",
"value": "P_98"
},
// "Root.General.SubprojectId:_"
{
"operator": "exact_match",
"field": "/Root/General/SubprojectId",
"value": "_"
},
// "Root.General.Id:C_1"
{
"operator": "exact_match",
"field": "/Root/General/Id",
"value": "C_1"
},
// "Root.General.Title:test"
{
"operator": "exact_match",
"field": "/Root/General/Title",
"value": "test"
},
// "~Root.General.Title:test"
{
"operator": "simple_search",
"fields": [
"/Root/General/Title"
],
"value": "test"
},
// "-Root.General.Title:test"
{
"operator": "not",
"operand": {
"operator": "exact_match",
"field": "/Root/General/TestSuiteId",
"value": "SP_1"
}
},
// "Root.General.Id:(C_1 OR C_2 OR C_3)"
{
"operator": "or",
"operands": [
{
"operator": "exact_match",
"field": "/Root/General/Id",
"value": "C_1"
},
{
"operator": "exact_match",
"field": "/Root/General/Id",
"value": "C_2"
},
{
"operator": "exact_match",
"field": "/Root/General/Id",
"value": "C_3"
}
]
}
]
}