Help Contents

 

Resource: Search ( /api/search )

Search resource, used for retrieving the results of a TQL query.

Root Relation: Search

This resource supports the following methods: GET, POST

Methods

GET


Retrieves all (or a subset) of entities that are visible to the user. The search resource supports both standard and aggregate TQL query expressions. For long queries you can use the POST method instead.

This method supports the TQL query parameters tql, $top, $take and $inlinecount. See TQL Topic for more details.

Required Permissions

  • TestManagement/View

Status Codes

These are the expected status codes returned by the service. In addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.

Example - Search for entities by TQL query

Searching for entities by TQL query.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlName ~ 'test'Search for all entities containing the word 'test'.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 1,
  "Total": 1,
  "Items": [
    {
      "Id": "48adfe56-69a6-4832-b826-a004016a11e2",
      "Type": "Unit",
      "Name": "JUnit Test Results",
      "CreatedAt": "2012-02-27T08:58:15Z",
      "LastUpdatedAt": "2012-02-27T10:08:20Z",
      "CreatedById": "5b2b0ad0-5371-4abf-a661-9f410088925f",
      "CreatedBy": "Administrator",
      "LastUpdatedById": "5b2b0ad0-5371-4abf-a661-9f410088925f",
      "LastUpdatedBy": "Administrator",
      "PackageId": "d69ff488-5a76-4b8c-b604-9fde010719e1",
      "ProjectId": "2aa8fba4-8f0b-4c4b-a7ef-9fde010719de",
      "ProjectName": "Project X",
      "PackageName": "Script Library",
      "OrderNumber": 2,
      "Expands": [
        "Assignments",
        "Configuration"
      ],
      "EntityType": "AutomatedTest",
      "Self": "http://localhost/EnterpriseTester/api/automatedtest/48adfe56-69a6-4832-b826-a004016a11e2"
    }
}

Status Code

200 - OK

Example - Searching for entities by a TQL query that includes one or more dates and pass in time zone for the query.

Searching for entities by TQL query that includes dates, and pass in timezone for the query.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlCreatedAt >= 2012-02-1Search for all entities created on February 2012 and later.
timeZoneAmerica/New_YorkTime zone used for date calculations.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 1,
  "Total": 1,
  "Items": [
    {
      "Id": "48adfe56-69a6-4832-b826-a004016a11e2",
      "Type": "Unit",
      "Name": "JUnit Test Results",
      "CreatedAt": "2012-02-27T08:58:15Z",
      "LastUpdatedAt": "2012-02-27T10:08:20Z",
      "CreatedById": "5b2b0ad0-5371-4abf-a661-9f410088925f",
      "CreatedBy": "Administrator",
      "LastUpdatedById": "5b2b0ad0-5371-4abf-a661-9f410088925f",
      "LastUpdatedBy": "Administrator",
      "PackageId": "d69ff488-5a76-4b8c-b604-9fde010719e1",
      "ProjectId": "2aa8fba4-8f0b-4c4b-a7ef-9fde010719de",
      "ProjectName": "Project X",
      "PackageName": "Script Library",
      "OrderNumber": 2,
      "Expands": [
        "Assignments",
        "Configuration"
      ],
      "EntityType": "AutomatedTest",
      "Self": "http://localhost/EnterpriseTester/api/automatedtest/48adfe56-69a6-4832-b826-a004016a11e2"
    }
}

Status Code

200 - OK

Example - Search for entities by TQL query, in different index

Searching for entities by TQL query (using different index) - Note: within the response the 'IndexName' is also included as a top-level property.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlName ~ 'smoke'Search for all entities containing the word 'smoke'.
indexNameRunSearch using the Run index.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 1,
  "Total": 1,
  "Items": [
    {
        "Id": "a2e642a5-bd5d-48e6-b67d-a153017a5272",
        "AssignedToId": null,
        "AssignedTo": null,
        "Description": null,
        "Name": "Smoke test integration with SAP",
        "Notes": null,
        "Number": 5,
        "Objective": null,
        "PostCondition": null,
        "PreCondition": null,
        "PriorityId": "8f8dc3ff-f98b-411c-9bd3-a14300fbebc0",
        "StatusId": "a15eb86a-ce86-42c7-9881-a14300fbebc4",
        "TypeId": "fa450444-cf62-4b1f-b9c4-a14300fbebc6",
        "SourceId": null,
        "SourceContainerId": null,
        "PackageId": "e4658145-e54d-4a11-8550-a14300fbebca",
        "OrderNumber": 0,
        "ProjectId": "8dfa0afa-25ee-4ce1-bc92-a14300fbebb2",
        "ProjectName": "Test",
        "PackageName": "Execution Sets",
        "EstimatedDuration": "",
        "ActualDuration": "",
        "ExecutionStatus": "Not Run",
        "AgileRunNumberReadOnly": true,
        "Expands": [
            "Widgets",
            "FieldValues",
            "Steps"
        ],
        "EntityType": "AgileRun",
        "Self": "http://localhost/EnterpriseTester/api/agilerun/a2e642a5-bd5d-48e6-b67d-a153017a5272",
        "Links": [
            {
                "Href": "http://localhost/EnterpriseTester/api/agilerun/a2e642a5-bd5d-48e6-b67d-a153017a5272/relationships",
                "Rel": "Relationships"
            },
            {
                "Href": "http://localhost/EnterpriseTester/api/agilerun/a2e642a5-bd5d-48e6-b67d-a153017a5272/allrelationships",
                "Rel": "AllRelationships"
            }
        ]
    }],
    "IndexName": "Run",
    "Self": "http://localhost:8092/EnterpriseTester/api/search?indexName=Run",
    "Links": [
        {
            "Href": "http://localhost:8092/EnterpriseTester/api/search?indexName=Run&$skip=25&$top=25",
            "Rel": "next"
        },
        {
            "Href": "http://localhost:8092/EnterpriseTester/api/search?indexName=Run&$skip=95&$top=25",
            "Rel": "last"
        }
    ]
    }
}

Status Code

200 - OK

Example - Search for entities by TQL query

Searching for entities by TQL query (format results flattened for grid).

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlName ~ 'test'Search for all entities containing the word 'test'.
formatgridFormat the results for rendering in a grid.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 1,
  "Total": 1,
  "Items": [
    {
      "AssociatedRequirements": "",
      "Type": "Unit",
      "Name": "JUnit Test Results",
      "OrderNumber": 2,
      "Id": "48adfe56-69a6-4832-b826-a004016a11e2",
      "EntityType": "AutomatedTest",
      "Package": "Project X/Script Library",
      "CreatedAt": "2012-02-27T08:58:15Z",
      "LastUpdatedAt": "2012-02-27T10:08:20Z",
      "LastUpdatedBy": "Joe Bloggs (Administrator)",
      "CreatedBy": "Joe Bloggs (Administrator)",
      "EditLink": "#/automatedtest/edit/48adfe56-69a6-4832-b826-a004016a11e2",
      "PackageId": "d69ff488-5a76-4b8c-b604-9fde010719e1",
      "Project": "Project X",
      "ProjectId": "2aa8fba4-8f0b-4c4b-a7ef-9fde010719de"
    }
},

Status Code

200 - OK

Example - Search for entities by TQL query

Searching for entities by TQL query (format results flattened for grid, with column metadata included in the results).

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlName ~ 'test'Search for all entities containing the word 'test'.
formatgridFormat the results for rendering in a grid.
$expandColumnsReturns the grid results with column metadata.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 1,
  "Total": 1,
  "Items": [
    {
    "Columns": [
        {
          "Sortable": true,
          "DefaultToHidden": false,
          "Header": "Entity Type",
          "Name": "EntityType",
          "Type": "string",
          "DefaultWidth": 100,
          "PreEncoded": false
        },
        {
          "Sortable": true,
          "DefaultToHidden": false,
          "Header": "Package",
          "Name": "Package",
          "Type": "string",
          "DefaultWidth": 200,
          "PreEncoded": false
        },
        {
          "Sortable": true,
          "DefaultToHidden": false,
          "Header": "Name",
          "Name": "Name",
          "Type": "string",
          "DefaultWidth": 50,
          "PreEncoded": false
        },
        ....
      ],
      "AssociatedRequirements": "",
      "Type": "Unit",
      "Name": "JUnit Test Results",
      "OrderNumber": 2,
      "Id": "48adfe56-69a6-4832-b826-a004016a11e2",
      "EntityType": "AutomatedTest",
      "Package": "Project X/Script Library",
      "CreatedAt": "2012-02-27T08:58:15Z",
      "LastUpdatedAt": "2012-02-27T10:08:20Z",
      "LastUpdatedBy": "Joe Bloggs (Administrator)",
      "CreatedBy": "Joe Bloggs (Administrator)",
      "EditLink": "#/automatedtest/edit/48adfe56-69a6-4832-b826-a004016a11e2",
      "PackageId": "d69ff488-5a76-4b8c-b604-9fde010719e1",
      "Project": "Project X",
      "ProjectId": "2aa8fba4-8f0b-4c4b-a7ef-9fde010719de"
    }
},

Status Code

200 - OK

Example - Search for entities by TQL query

Searching for entities by TQL query (format results flattened for grid).

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlName ~ 'test'Search for all entities containing the word 'test'.
formatgridFormat the results for rendering in a grid.
$expandColumnsReturns the grid results with column metadata.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Status Code

200 - OK

Example - Execute an aggregated expression as a tree of nodes

Return the results of an aggregated expression.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlGROUP BY Status { Count } as "Statuses" WHERE EntityType = RequirementReturn results of an aggregated expression.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Results": {
    "Statuses": {
      "Approved": {
        "Count": 48
      },
      "Review Pending": {
        "Count": 4
      },
      "In Progress": {
        "Count": 10
      },
      "N/A": {
        "Count": 49
      },
      "No Run": {
        "Count": 34
      },
      "Not Covered": {
        "Count": 3
      },
      "Passed": {
        "Count": 15
      },
      "Requires Rework": {
        "Count": 1
      }
    }
  }
}

Status Code

200 - OK

Example - Execute an aggregated expression (returning results formatted for an ExtJS style tree)

Return the results of an aggregated expression returning results formatted for an ExtJS style tree - this will convert entity results into edit links within ET.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlGROUP BY Status { Count } as "Statuses" WHERE EntityType = RequirementReturn results of an aggregated expression.
fomatextjstreeOutput results suitable for rendering by a Sencha ExtJS tree component.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Results": {
    "text": "Results",
    "expanded": true,
    "iconCls": "summary-results-root",
    "children": [
      {
        "text": "Statuses",
        "expanded": true,
        "iconCls": "summary-results-dictionary",
        "children": [
          {
            "text": "Approved",
            "expanded": true,
            "iconCls": "summary-results-dictionary",
            "children": [
              {
                "text": "Count: 48",
                "iconCls": "summary-results-value-number",
                "leaf": true
              }
            ]
          },
          {
            "text": "Review Pending",
            "expanded": true,
            "iconCls": "summary-results-dictionary",
            "children": [
              {
                "text": "Count: 4",
                "iconCls": "summary-results-value-number",
                "leaf": true
              }
            ]
          },
          {
            "text": "In Progress",
            "expanded": true,
            "iconCls": "summary-results-dictionary",
            "children": [
              {
                "text": "Count: 10",
                "iconCls": "summary-results-value-number",
                "leaf": true
              }
            ]
          },
          {
            "text": "N/A",
            "expanded": true,
            "iconCls": "summary-results-dictionary",
            "children": [
              {
                "text": "Count: 49",
                "iconCls": "summary-results-value-number",
                "leaf": true
              }
            ]
          },
          {
            "text": "No Run",
            "expanded": true,
            "iconCls": "summary-results-dictionary",
            "children": [
              {
                "text": "Count: 34",
                "iconCls": "summary-results-value-number",
                "leaf": true
              }
            ]
          },
          {
            "text": "Not Covered",
            "expanded": true,
            "iconCls": "summary-results-dictionary",
            "children": [
              {
                "text": "Count: 3",
                "iconCls": "summary-results-value-number",
                "leaf": true
              }
            ]
          },
          {
            "text": "Passed",
            "expanded": true,
            "iconCls": "summary-results-dictionary",
            "children": [
              {
                "text": "Count: 15",
                "iconCls": "summary-results-value-number",
                "leaf": true
              }
            ]
          },
          {
            "text": "Requires Rework",
            "expanded": true,
            "iconCls": "summary-results-dictionary",
            "children": [
              {
                "text": "Count: 1",
                "iconCls": "summary-results-value-number",
                "leaf": true
              }
            ]
          }
        ]
      }
    ]
  }
}

Status Code

200 - OK

POST


Retrieves all (or a subset) of entities that are visible to the user. The search resource supports both standard and aggregate TQL query expressions. The parameters must be passed in using the x-www-form-urlencoded content type.

This method supports the TQL query parameters tql, $top, $take and $inlinecount. See TQL Topic for more details.

Required Permissions

  • TestManagement/View

Status Codes

These are the expected status codes returned by the service. In addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.