Use the Audits_LoadElevated
operation to get version history (we call it audits) for one or more items in QAComplete. You can get:
-
Audits that match a condition, for example:
- Audits for a specific item (a defect, release, and so on)
- Audits made before, on, or after a specific date
- Audits made within a date range
- Audits made by a specific user
-
All audits for all items of certain type (defects, releases, and so on) – If no condition is specified.
To specify a project to load audits from, use the ProjId
value in the AuthenticationData
object in the request body.
You can use the OrderBy
parameter to sort the audits before returning them from QAComplete.
Parameters
The operation uses the following parameters:
AuthenticationData : AuthenticationData, required
An AuthenticationData
object with the login information and the ID of the project that contains the audits.
EntityCode : string, required
The type of the items whose audits you want to get. Possible values:
- Bugs (defects)
- Contacts
- FileExchanges (shared documents)
- FunctionalSpecs (requirements)
- ProjectPlans
- ProjectPlanTasks
- ProjectTasks (agile tasks)
- Releases
- TestCases (legacy test cases used in release 9.6.0 and earlier)
- TestConfigurations
- Tests
- TestSets
Where : string, required
A string that describes the audits you want to get. Use the syntax as in SQL WHERE clauses. For dates and time values, use the 'YYYY-MM-DD HH:MM:SS'
format.
An empty string means all audits for all items of the specified type.
Examples:
-
Audits for an item with a specific ID:
FKId = 1234
-
Audits made after a specific date:
DateCreated > '2014-07-25'
-
Audits made during a date range:
DateCreated > '2014-07-25' and DateCreated < '2014-07-30'
-
Audits made by a specific user:
UpdateUserId = 27568
UpdateName = 'McLaren, Susan'
In raw SOAP requests, you need to encode <
and &
characters as <
and &
, or put the string inside CDATA.
OrderBy : string
The order to sort the audits before returning them from the web service. For example, by the ID of the changed items or by the audit date. The format is:
Property1 [ASC | DESC ][, Property2 [ASC | DESC ]] [, ...]]]
where property names are those of the Audit
object. If you omit ASC or DESC after a property name, audits are sorted in ascending order.
Example values:
To keep the default sort order, use an empty string or a null value.
Result
An array of Audit
objects that contains the audit information.
Example
Sample Code
The example below prints a list of changes made to defects after July 25, 2014.
C#
string login = "[email protected]";
string password = "p@ssword";
int projID = 10372;
// Specifying conditions
string entityCode = "Defects";
string condition = "DateCreated > '2014-07-25'";
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;
// Preparing an array of audit objects
Audit[] audits = service.Audits_LoadElevated(authData, entityCode, condition, "");
foreach (Audit audit in audits)
{
Console.WriteLine("{0}: {1}", audit.DateCreated, audit.Title);
}
Java
String login = "[email protected]";
String password = "p@ssword";
int projID = 10372;
// Specifying conditions
String entityCode = "Defects";
String condition = "DateCreated > '2014-07-25'";
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);
// Preparing an array of audit objects
List<Audit> audits = service.auditsLoadElevated(authData, entityCode, condition, "").getAudit();
for (Audit audit : audits)
{
System.out.format("%s: %s%n", audit.getDateCreated(), audit.getTitle());
}
Sample Request XML
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 555 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/Audits_LoadElevated"
<?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>
<Audits_LoadElevated xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
<EntityCode>Defects</EntityCode>
<Where>DateCreated > '2014-07-25'</Where>
</Audits_LoadElevated>
</soap:Body>
</soap:Envelope>
SOAP 1.2
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 563 {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>
<Audits_LoadElevated xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
<EntityCode>Defects</EntityCode>
<Where>DateCreated > '2014-07-25'</Where>
</Audits_LoadElevated>
</soap12:Body>
</soap12:Envelope>
Sample Response XML
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 1046 {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>
<Audits_LoadElevatedResponse xmlns="http://www.pragmaticsw.com/">
<Audits_LoadElevatedResult>
<Audit>
<FKId>13254</FKId>
<EntityCode>Defects</EntityCode>
<Title>Updated Status</Title>
<OldValue>Active</OldValue>
<NewValue>Resolved</NewValue>
<DateCreated>2014-07-25T01:28:18.53</DateCreated>
<Description></Description>
<ProjId>10372</ProjId>
<UpdateUserId>27568</UpdateUserId>
<UserName>McLaren, Susan</UserName>
</Audit>
<Audit>
<FKId>13255</FKId>
<EntityCode>Defects</EntityCode>
<Title>Updated Date Resolved</Title>
<OldValue></OldValue>
<NewValue>2014-07-25T01:45:31.147</NewValue>
<DateCreated>2014-07-25T01:45:35.64</DateCreated>
<Description></Description>
<ProjId>10372</ProjId>
<UpdateUserId>27568</UpdateUserId>
<UserName>McLaren, Susan</UserName>
</Audit>
</Audits_LoadElevatedResult>
</Audits_LoadElevatedResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1056 {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>
<Audits_LoadElevatedResponse xmlns="http://www.pragmaticsw.com/">
<Audits_LoadElevatedResult>
<Audit>
<FKId>13254</FKId>
<EntityCode>Defects</EntityCode>
<Title>Updated Status</Title>
<OldValue>Active</OldValue>
<NewValue>Resolved</NewValue>
<DateCreated>2014-07-25T01:28:18.53</DateCreated>
<Description></Description>
<ProjId>10372</ProjId>
<UpdateUserId>27568</UpdateUserId>
<UserName>McLaren, Susan</UserName>
</Audit>
<Audit>
<FKId>13255</FKId>
<EntityCode>Defects</EntityCode>
<Title>Updated Date Resolved</Title>
<OldValue></OldValue>
<NewValue>2014-07-25T01:45:31.147</NewValue>
<DateCreated>2014-07-25T01:45:35.64</DateCreated>
<Description></Description>
<ProjId>10372</ProjId>
<UpdateUserId>27568</UpdateUserId>
<UserName>McLaren, Susan</UserName>
</Audit>
</Audits_LoadElevatedResult>
</Audits_LoadElevatedResponse>
</soap12:Body>
</soap12:Envelope>
See Also
Audit Operations
Audits_Add
Helper Operations
SOAP API Reference