User_Add Operation

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

Registers a new user and grants this user access to the project specified by the AuthenticationData.ProjId parameter.

QAComplete then sends this user a registration email with a password reset link.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object with the web service login information and the ID of the project that the user will have access to.

User  :  User, required

A User object with the user information. Only the FirstName, LastName, and Email are required. Password is needed only for service and test accounts; real users will have to reset the password by following the instructions in the registration email.

If you do not specify SecurityGroup, QAComplete will add the user to the alphabetically first group.

Result

The ID of the created user.

Example

Sample Code

C#

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

ServiceSoapClient service = new ServiceSoapClient();

// Prepare 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;

// Prepare the user object
User user = new User();
user.FirstName = "Alex";
user.LastName = "Fry";
user.Email = "[email protected]";
user.SecurityGroup = "Expert Users";

// Add the user
int Id = service.User_Add(authData, user);
Console.WriteLine("The ID of the created user: {0}", Id);

Java

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

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

// Prepare 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);

// Prepare the user object
User user = new User();
user.setFirstName("Alex");
user.setLastName("Fry");
user.setEmail("[email protected]");
user.setSecurityGroup("Expert Users");

// Add the user
int Id = service.userAdd(authData, user);
System.out.format("The ID of the created user: %d%n", Id);

Sample Request XML

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 603 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/User_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>
    <User_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>8162</DeptId>
        <ProjId>11873</ProjId>
        <UserId>24661</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <User>
        <FirstName>Alex</FirstName>
        <LastName>Fry</LastName>
        <Email>[email protected]</Email>
        <SecurityGroup>Expert Users</SecurityGroup>
      </User>
    </User_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: 611 {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>
    <User_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>8162</DeptId>
        <ProjId>11873</ProjId>
        <UserId>24661</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <User>
        <FirstName>Alex</FirstName>
        <LastName>Fry</LastName>
        <Email>[email protected]</Email>
        <SecurityGroup>Expert Users</SecurityGroup>
      </User>
    </User_Add>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

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

SOAP 1.2

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

See Also

Users Operations
SOAP API Reference

Highlight search results