Audits_Add Operation

Applies to QAComplete�14.4, last modified on August 06, 2024

Adds an audit (a version history entry) for a defect, release, or other item. You specify the changed item and the change in the Audit parameter.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object with the login information and the project ID that contains the changed item.

Audit  :  Audit, required

An Audit object with information about the changed item and the change made.

Result

None.

Remarks

Do not specify the following audit properties; they are set automatically:

  • DateCreated is set to the current date and time.

  • Description is ignored.

  • UpdateUserId and UserName are set to the authenticating user.

  • ProjId is set to AuthenticationData.ProjId.

The Audit object has matching UpdateUserId and UserName properties. To set them, specify the value only for the UpdateUserId property. The UserName property will be set automatically.

Example

Sample Code

Th example below adds an audit for a defect with the ID 13254. The audit says that the defect status was changed from Active to Resolved.

C#

string login = "[email protected]";
string password = "p@ssword";
int projID = 10372;

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 the Audit object
Audit audit = new Audit();
audit.EntityCode = "Bugs";
audit.FKId = 13254;
audit.Title = "Updated Status";
audit.OldValue = "Active";
audit.NewValue = "Resolved";

// Adding an audit
service.Audits_Add(authData, audit);
Console.WriteLine("Audit has been created.");

Java

String login = "[email protected]";
String password = "p@ssword";
int projID = 10372;

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 the Audit object
Audit audit = new Audit();
audit.setEntityCode("Bugs");
audit.setFKId(13254);
audit.setTitle("Updated Status");
audit.setOldValue("Active");
audit.setNewValue("Resolved");

// Adding an audit
service.auditsAdd(authData, audit);
System.out.println("Audit has been created.");

Sample Request XML

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

<?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_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <Audit>
        <FKId>13254</FKId>
        <EntityCode>Defects</EntityCode>
        <Title>Updated Status</Title>
        <OldValue>Active</OldValue>
        <NewValue>Resolved</NewValue>
      </Audit>
    </Audits_Add>
  </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: 622 {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_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <Audit>
        <FKId>13254</FKId>
        <EntityCode>Defects</EntityCode>
        <Title>Updated Status</Title>
        <OldValue>Active</OldValue>
        <NewValue>Resolved</NewValue>
      </Audit>
    </Audits_Add>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 304 {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_AddResponse xmlns="http://www.pragmaticsw.com/" />
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 314 {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_AddResponse xmlns="http://www.pragmaticsw.com/" />
  </soap12:Body>
</soap12:Envelope>

See Also

Audit Operations
Audits_LoadElevated
Helper Operations
SOAP API Reference

Highlight search results