We've almost finished web services API implementation for TP 2.3 release. It looks quite powerful and provides huge integration capabilities. With web services API you may do almost anything: add, edit and delete new entities, retrieve entities and even execute custom queries based on HQL (Hibernate Query Language). Of course you need to know HQL syntax (close to SQL in fact) and understand TargetProcess domain model to create complex queries. So we share entities description, class diagrams and NHibernate mapping files.
Here are some examples that shows web services abilities.
Add new bug into TargetProcess.
BugServiceWse bugService = new BugServiceWse(); TpPolicy.ApplyAutheticationTicket(bugService, "admin", "admin"); BugDTO bug = new BugDTO(); bug.Name = "New bug"; bug.CreateDate = DateTime.Today; bug.Description = "Bug Description"; bug.ProjectID = 1; int bugId = bugService.Create(bug); Console.WriteLine(bugId);
Add comment to existing user story.
UserStoryServiceWse service = new UserStoryServiceWse(); TpServicePolicy.ApplyAutheticationTicket(service, "admin", "admin"); int storyId = 98; CommentDTO comment = new CommentDTO(); comment.Description = "New Comment"; int commId = service.AddCommentToUserStory(storyId , comment);
Exampe with complex HQL query. Select all user stories assigned to user
string userName = "admin"; string userPassword = "admin"; UserStoryServiceWse userStoryService = new UserStoryServiceWse(); TpServicePolicy.ApplyAutheticationTicket( userStoryService, userName, userPassword); string hqlAssignedUserStoryQuery = @"from UserStory as us where us.UserStoryID in (select team.Assignable.AssignableID from Team as team where team.User.UserID = ? and team.Actor = us.EntityState.Actor and team.Assignable.AssignableID = us.UserStoryID)"; UserStoryDTO[] stories = userStoryService.Retrieve( hqlAssignedUserStoryQuery, new object[] {users[0].UserID});
Add comment