TraceabilityLinks_LoadByCriteria Operation

Applies to QAComplete 12.71 SaaS & On-Premises, last modified on April 26, 2021

Use the TraceabilityLinks_LoadByCriteria operation to:

  • Get TracebilityLink objects that match a specific condition. For example, created on a specific day.

  • Get all TracebilityLink objects in QAComplete projects (if no condition is specified).

The operation can get links from one or several projects. To specify a project to get links from, use the ProjId value in the AuthenticationData object in the request body. To get links from several projects, use the ProjIds value in the AuthenticationData object to specify the list of project IDs.

LoadByCriteria returns results in pages (subsets of data) rather than all at once. Pagination is controlled by the PageSize and PageNumber parameters. For information about working with paginated results, see LoadByCriteria Operations.

You can use the Sorting parameter to sort the TraceabilityLink objects before returning them from QAComplete.

Requirements

The authenticating user must belong to a security group that has access to the Manage and view traceability and Read, Add, and Update privileges for linked items.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object with the login information and the ID of the project (or the list of project IDs) from which you want to get linked items.

Condition  :  string

An XML-formatted string that describes the links you want to get. For the syntax and examples, see Condition Syntax.

If you create SOAP requests manually, place the condition string inside CDATA.

To get all requirements, use an empty string or a null value.

Sorting  :  string

The order to sort the results before returning them from the web service. For example, by requirement ID or last updated date. The format is:

Property1 [ASC | DESC ][, Property2 [ASC | DESC ]] [, ...]]]

where property names are those of the TraceabilityLink object. If you omit ASC or DESC after a property name, requirements are sorted in ascending order.

Example values:

FunctSpecId
AssignedToName, BugId
DateUpdated DESC

To keep the default sort order, use an empty string or a null value.

PageSize  :  integer, required

Limits the number of traceability links to return in one page. Possible values: 1..200.

The last page may have less items than PageSize. This means the end of the result set.

PageNumber  :  integer, required

A number starting from 1 that specifies the data page to return in the response. To get all pages, send several requests with increasing PageNumber values. For example, if PageSize is 100, PageNumber of 1 will return links 1..100, PageNumber of 2 – links 101..200 and so on.

If PageNumber exceeds the range, an empty array is returned. If PageNumber is the last page, this page may have less items than PageSize.

Result

An array of TraceabilityLink objects that contain the link information.

Example

Sample Code

C#

string login = "john.doe@example.com";
string password = "p@ssword";
int projID = 10372;

// Specifying condition
string Condition =
@"<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema' Operation='opLIKE'>
  <Items Type='tField'>
    <Value xsi:type='xsd:string'>Title</Value>
  </Items>
  <Items Type='tString'>
    <Value xsi:type='xsd:string'>TestApplication: Release 1.0/Alfa</Value>
  </Items>
</Conditions>";
// Specifying the desired sorting
string Sorting = "";
int pageSize = 10;
ServiceSoapClient service = new ServiceSoapClient();

// Preparing AuthenticationData
LoginInfo loginInfo = service.GetLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.AppCode = loginInfo.AppCode;
authData.UserId = loginInfo.UserId;
authData.PassCode = password;
authData.DeptId = loginInfo.DeptId;
authData.ProjId = projID;

// Getting an array of TraceabilityLink objects
TraceabilityLink[] links = new TraceabilityLink[0];
int pageNumber = 1;

do
{
  links = service.TraceabilityLinks_LoadByCriteria(authData, Condition, Sorting, pageSize, pageNumber);
  foreach (TraceabilityLink link in links)
  {
    Console.WriteLine("EntityCode: {0}; ID: {1}", link.EntityCode, link.FKId);
  }
  pageNumber++;
} while (links.Length == pageSize);

Java

String login = "john.doe@example.com";
String password = "p@ssword";
int projID = 10372;

// Specifying condition
String Condition =
"<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n" +
"            xmlns:xsd='http://www.w3.org/2001/XMLSchema' Operation='opLIKE'>\n" +
"  <Items Type='tField'> \n" +
"    <Value xsi:type='xsd:string'>Title</Value> \n" +
"  </Items> \n" +
"  <Items Type='tString'> \n" +
"    <Value xsi:type='xsd:string'>TestApplication: Release 1.0/Alfa</Value> \n" +
"  </Items> \n" +
"</Conditions>";

// Specifying the desired sorting
String Sorting = "";
int pageSize = 10;

ServiceSoap service = new Service().getServiceSoap12();

// Preparing AuthenticationData
LoginInfo loginInfo = service.getLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.setAppCode(loginInfo.getAppCode());
authData.setUserId(loginInfo.getUserId());
authData.setPassCode(password);
authData.setDeptId(loginInfo.getDeptId());
authData.setProjId(projID);

// Getting an array of TraceabilityLink objects
List<TraceabilityLink> links;
int pageNumber = 1;

do
{
    links = service.traceabilityLinksLoadByCriteria(authData, Condition, Sorting, pageSize, pageNumber).getTraceabilityLink();
    for (TraceabilityLink link : links)
    {
        System.out.format("EntityCode: %s; ID: %d%n", link.getEntityCode(), link.getFKId() );
    }
    pageNumber++;
} while (links.size() == pageSize);

Sample Request XML

POST /psws/psws.asmx HTTP/1.1
 Host: myteam.mysite.com
 Content-Type: text/xml; charset=utf-8
 Content-Length: 919 {Insert an appropriate value here}
 SOAPAction: "http://www.pragmaticsw.com/TraceabilityLink_LoadByCriteria"
 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <TraceabilityLink_LoadByCriteria xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <Condition>
        <![CDATA[<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xmlns:xsd='http://www.w3.org/2001/XMLSchema'
        Operation='opLIKE'>
          <Items Type='tField'>
            <Value xsi:type='xsd:string'>Title</Value>
          </Items>
          <Items Type='tString'>
            <Value xsi:type='xsd:string'>Release 1.0/Alfa</Value>
          </Items>
        </Conditions>]]>
      </Condition>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </TraceabilityLink_LoadByCriteria>
  </soap:Body>
</soap:Envelope>

POST /psws/psws.asmx HTTP/1.1
 Host: myteam.mysite.com
 Content-Type: application/soap+xml; charset=utf-8
 Content-Length: 927 {Insert an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <TraceabilityLink_LoadByCriteria xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <Condition>
        <![CDATA[<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xmlns:xsd='http://www.w3.org/2001/XMLSchema'
        Operation='opLIKE'>
          <Items Type='tField'>
            <Value xsi:type='xsd:string'>Title</Value>
          </Items>
          <Items Type='tString'>
            <Value xsi:type='xsd:string'>Release 1.0/Alfa</Value>
          </Items>
        </Conditions>]]>
      </Condition>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </TraceabilityLink_LoadByCriteria>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 1161 {The server returns an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <TraceabilityLink_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <TraceabilityLink_LoadByCriteriaResult>
        <TraceabilityLink>
          <LinkId>34</LinkId>
          <ProjId>10372</ProjId>
          <EntityCode>Bugs</EntityCode>
          <FKId>33</FKId>
          <LinkedEntityCode>Release</LinkedEntityCode>
          <LinkedFKId>23</LinkedFKId>
          <Status>In Progress</Status>
          <Title>FamilyAlbum: Release 1.0/Alfa/0.4.86</Title>
          <LinkType>Found in build</LinkType>
          <DateUpdated>2014-07-15T23:11:12.237</DateUpdated>
        </TraceabilityLink>
        <TraceabilityLink>
          <LinkId>56</LinkId>
          <ProjId>10372</ProjId>
          <EntityCode>Tests</EntityCode>
          <FKId>42</FKId>
          <LinkedEntityCode>Release</LinkedEntityCode>
          <LinkedFKId>23</LinkedFKId>
          <Status>In Progress</Status>
          <Title>FamilyAlbum: Release 1.0/Alfa/0.4.86</Title>
          <LinkType>Functional tests</LinkType>
          <DateUpdated>2014-07-23T16:05:20.249</DateUpdated>
        </TraceabilityLink>
      </TraceabilityLink_LoadByCriteriaResult>
    </TraceabilityLink_LoadByCriteriaResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1171 {The server returns an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <TraceabilityLink_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <TraceabilityLink_LoadByCriteriaResult>
        <TraceabilityLink>
          <LinkId>34</LinkId>
          <ProjId>10372</ProjId>
          <EntityCode>Bugs</EntityCode>
          <FKId>33</FKId>
          <LinkedEntityCode>Release</LinkedEntityCode>
          <LinkedFKId>23</LinkedFKId>
          <Status>In Progress</Status>
          <Title>FamilyAlbum: Release 1.0/Alfa/0.4.86</Title>
          <LinkType>Found in build</LinkType>
          <DateUpdated>2014-07-15T23:11:12.237</DateUpdated>
        </TraceabilityLink>
        <TraceabilityLink>
          <LinkId>56</LinkId>
          <ProjId>10372</ProjId>
          <EntityCode>Tests</EntityCode>
          <FKId>42</FKId>
          <LinkedEntityCode>Release</LinkedEntityCode>
          <LinkedFKId>23</LinkedFKId>
          <Status>In Progress</Status>
          <Title>FamilyAlbum: Release 1.0/Alfa/0.4.86</Title>
          <LinkType>Functional tests</LinkType>
          <DateUpdated>2014-07-23T16:05:20.249</DateUpdated>
        </TraceabilityLink>
      </TraceabilityLink_LoadByCriteriaResult>
    </TraceabilityLink_LoadByCriteriaResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

TraceabilityLinks_Add
TraceabilityLinks_Delete
TraceabilityLinks_Load
Traceability Operations
SOAP API Reference

Highlight search results