The code below uses the Releases_Add
operation to add a new release to a QAComplete project. To create an iteration or build, specify the appropriate value for the Release.ReleaseType
property.
You can create other items – defects, requirements, and so on – in a similar way. Just use the corresponding operation – Bugs_Add
for defects, FunctionalSpecs_Add
for requirements, and so on. For a list of available operations, see SOAP API Reference.
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 release object
Release release = new Release();
release.Title = "New Release";
release.Description = "The first release of the product";
release.ReleaseType = "Release";
release.ProjId = projId;
release.StatusCode = "Awaiting Start";
release.IsActive = "N";
release.IsAutoAdjustEstDates = "N";
release.EstStartDate = DateTime.Today;
release.EstFinishDate = release.EstStartDate.AddMonths(1);
// Adding the release
int releaseID = service.Releases_Add(authData, release, "", null);
Console.WriteLine("ID of the new release: " + releaseID);
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 release object
Release release = new Release();
release.setTitle("New Release");
release.setDescription("The first release of the product");
release.setReleaseType("Release");
release.setProjId(projId);
release.setStatusCode("Awaiting Start");
release.setIsActive("N");
release.setIsAutoAdjustEstDates("N");
XMLGregorianCalendar now;
XMLGregorianCalendar afterMonth;
try
{
now = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
afterMonth = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
afterMonth.setMonth(now.getMonth() + 1);
release.setEstStartDate(now);
release.setEstFinishDate(afterMonth);
}
catch (Exception e)
{
e.printStackTrace();
}
// Adding the release
int releaseID = service.releasesAdd(authData, release, "", null);
System.out.println("ID of the new release: " + releaseID);