How to approve a test plan using RQM Restful API?
We have a requirement to allow the approver to approve the test plan out of RQM web UI. Now we we query the approver information by such URL: https://<rqm server>:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/reources/<project name>/testplan?fields=feed/entry/content/testplan
[title='Test Plan sample 1']/approvals,
However we fail to modify the status by PUT method with the same URL. We tried to submit the same body GETted by above URL(with different approval status), but find the approval status didn't change.
Do we need to use test plan resource URL such as https://<rqm server>:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/reources/<project name>/testplan/urn:com.ibm.rqm:testplan:6? If so how about the content-type, and the http body format? We tried but also failed.
Accepted answer
When using the RQM Reportable REST API to update the approval status, you must be authenticated with the RQM server using the same user credentials as the approval owner.
I have tested this in RQM 4.0.1 using Poster and/or HttpRequester.
I have tested this in RQM 4.0.1 using Poster and/or HttpRequester.
5 other answers
Hi Haibo,
It looks like the state property is available for this operation - It is listed under Test Plan resource:
https://jazz.net/wiki/bin/view/Main/RqmApi#Resources_and_their_Supported_Op
You would need to use test plan resource URL to update the state property. However, I would like to know what error messages are you getting? Are you getting the 400 Bad Request error, or something else?
Cheers,
Will
It looks like the state property is available for this operation - It is listed under Test Plan resource:
https://jazz.net/wiki/bin/view/Main/RqmApi#Resources_and_their_Supported_Op
You would need to use test plan resource URL to update the state property. However, I would like to know what error messages are you getting? Are you getting the 400 Bad Request error, or something else?
Cheers,
Will
now we use test plan resource URL such as https://<rqm server="">:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/reources/<project name="">/testplan/urn:com.ibm.rqm:testplan:6. first:we use getMethod with the url ,and output the response to an xml file: <ns2:approvalStatus>com.ibm.team.workitem.approvalState.pending</ns2:approvalStatus>
second:we update the xml file. and put the file to url:put.setRequestEntity(new FileRequestEntity(file,"text/xml; charset=utf-8")); and the response is 200.
finally: we get results: if we add a new approver, than it is successfully update; but if we change original attribute value of approvalStatus to com.ibm.team.workitem.approvalState.approved ,it is failure although the response is 200.
this is why? and how to change the value of approvalStatus successfully? Thanks.
ps.the response of getMthod :
<?xml version="1.0" encoding="UTF-8"?>
<ns2:testplan xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/"
xmlns:ns1="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://purl.org/dc/elements/1.1/"
xmlns:ns4="http://jazz.net/xmlns/prod/jazz/process/0.6/" xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/"
xmlns:ns6="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns7="http://purl.org/dc/terms/"
xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/"
xmlns:ns10="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1"
xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1"
xmlns:ns13="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1"
xmlns:ns14="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1" xmlns:ns16="http://jazz.net/xmlns/alm/qm/styleinfo/v0.1/"
xmlns:ns17="http://www.w3.org/1999/XSL/Transform">
<ns2:projectArea alias="Btops+Testing+%28Quality+Management%29"
href="https://gpsclm4.austin.ibm.com:9443/qm/resource/itemOid/com.ibm.team.process.ProjectArea/_B9FmEqCzEeK0VvQV6eDnUA" />
<ns3:identifier>https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Btops+Testing+%28Quality+Management%29/testplan/slug__jk-AgAYdEeOsq6qttUV7jw
</ns3:identifier>
<ns2:stylesheet
href="https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Btops+Testing+%28Quality+Management%29/testplan/urn:com.ibm.rqm:testplan:7?stylesheet=true" />
<ns2:webId>7</ns2:webId>
<ns3:title>Test For BPM and RQM</ns3:title>
<ns3:description />
<ns2:creationDate>2013-08-16T02:42:56.314Z</ns2:creationDate>
<ns5:updated>2013-08-16T02:42:56.804Z</ns5:updated>
<ns5:state
ns6:resource="https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/process-info/_B9FmEqCzEeK0VvQV6eDnUA/workflowstate/com.ibm.rqm.process.testplan.workflow/com.ibm.rqm.planning.common.new">com.ibm.rqm.planning.common.new</ns5:state>
<ns3:creator
ns6:resource="https://gpsclm4.austin.ibm.com:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/wyixin@cn.ibm.com">wyixin@cn.ibm.com</ns3:creator>
<ns5:owner
ns6:resource="https://gpsclm4.austin.ibm.com:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/wyixin@cn.ibm.com">wyixin@cn.ibm.com</ns5:owner>
<ns2:priority
ns6:resource="https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/process-info/_B9FmEqCzEeK0VvQV6eDnUA/priority/literal.priority.101">literal.priority.101</ns2:priority>
<ns2:locked>false</ns2:locked>
<ns2:approvals>
<ns2:approvalDescriptor>
<ns2:id>0</ns2:id>
<ns2:name>Artifact Approval</ns2:name>
<ns2:approvalType>com.ibm.team.workitem.approvalType.approval
</ns2:approvalType>
<ns2:archived>false</ns2:archived>
<ns2:approval>
<ns2:approvalOwner
ns6:resource="https://gpsclm4.austin.ibm.com:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/wyixin@cn.ibm.com">wyixin@cn.ibm.com</ns2:approvalOwner>
<ns2:approvalStatus>com.ibm.team.workitem.approvalState.pending
</ns2:approvalStatus>
</ns2:approval>
</ns2:approvalDescriptor>
</ns2:approvals>
<ns3:alias>urn:com.ibm.rqm:testplan:7</ns3:alias>
<ns2:template
href="https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Btops+Testing+%28Quality+Management%29/template/testplan/com.ibm.rqm.planning.templates.testplan.default" />
</ns2:testplan>
second:we update the xml file. and put the file to url:put.setRequestEntity(new FileRequestEntity(file,"text/xml; charset=utf-8")); and the response is 200.
finally: we get results: if we add a new approver, than it is successfully update; but if we change original attribute value of approvalStatus to com.ibm.team.workitem.approvalState.approved ,it is failure although the response is 200.
this is why? and how to change the value of approvalStatus successfully? Thanks.
ps.the response of getMthod :
<?xml version="1.0" encoding="UTF-8"?>
<ns2:testplan xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/"
xmlns:ns1="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://purl.org/dc/elements/1.1/"
xmlns:ns4="http://jazz.net/xmlns/prod/jazz/process/0.6/" xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/"
xmlns:ns6="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns7="http://purl.org/dc/terms/"
xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/"
xmlns:ns10="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1"
xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1"
xmlns:ns13="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1"
xmlns:ns14="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1" xmlns:ns16="http://jazz.net/xmlns/alm/qm/styleinfo/v0.1/"
xmlns:ns17="http://www.w3.org/1999/XSL/Transform">
<ns2:projectArea alias="Btops+Testing+%28Quality+Management%29"
href="https://gpsclm4.austin.ibm.com:9443/qm/resource/itemOid/com.ibm.team.process.ProjectArea/_B9FmEqCzEeK0VvQV6eDnUA" />
<ns3:identifier>https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Btops+Testing+%28Quality+Management%29/testplan/slug__jk-AgAYdEeOsq6qttUV7jw
</ns3:identifier>
<ns2:stylesheet
href="https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Btops+Testing+%28Quality+Management%29/testplan/urn:com.ibm.rqm:testplan:7?stylesheet=true" />
<ns2:webId>7</ns2:webId>
<ns3:title>Test For BPM and RQM</ns3:title>
<ns3:description />
<ns2:creationDate>2013-08-16T02:42:56.314Z</ns2:creationDate>
<ns5:updated>2013-08-16T02:42:56.804Z</ns5:updated>
<ns5:state
ns6:resource="https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/process-info/_B9FmEqCzEeK0VvQV6eDnUA/workflowstate/com.ibm.rqm.process.testplan.workflow/com.ibm.rqm.planning.common.new">com.ibm.rqm.planning.common.new</ns5:state>
<ns3:creator
ns6:resource="https://gpsclm4.austin.ibm.com:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/wyixin@cn.ibm.com">wyixin@cn.ibm.com</ns3:creator>
<ns5:owner
ns6:resource="https://gpsclm4.austin.ibm.com:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/wyixin@cn.ibm.com">wyixin@cn.ibm.com</ns5:owner>
<ns2:priority
ns6:resource="https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/process-info/_B9FmEqCzEeK0VvQV6eDnUA/priority/literal.priority.101">literal.priority.101</ns2:priority>
<ns2:locked>false</ns2:locked>
<ns2:approvals>
<ns2:approvalDescriptor>
<ns2:id>0</ns2:id>
<ns2:name>Artifact Approval</ns2:name>
<ns2:approvalType>com.ibm.team.workitem.approvalType.approval
</ns2:approvalType>
<ns2:archived>false</ns2:archived>
<ns2:approval>
<ns2:approvalOwner
ns6:resource="https://gpsclm4.austin.ibm.com:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/wyixin@cn.ibm.com">wyixin@cn.ibm.com</ns2:approvalOwner>
<ns2:approvalStatus>com.ibm.team.workitem.approvalState.pending
</ns2:approvalStatus>
</ns2:approval>
</ns2:approvalDescriptor>
</ns2:approvals>
<ns3:alias>urn:com.ibm.rqm:testplan:7</ns3:alias>
<ns2:template
href="https://gpsclm4.austin.ibm.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Btops+Testing+%28Quality+Management%29/template/testplan/com.ibm.rqm.planning.templates.testplan.default" />
</ns2:testplan>
More information:
1) RQM version is 4.0.1
2) In our code we login as the approver first with j_security_check , and then use PUT to only update one approver approve status, we found whatever we want to change the approve status to(e.g. approved, rejected), the actual result is : it is changed to status 'pending'. That means if the approve status is rejected, after our code run, it is changed to 'pending'.
3) we verified that RQM api can only modify the approve status of logging, not other approvers. This is good for us.
ps:the format we change in code
<ns2:approvalStatus>com.ibm.team.workitem.approvalState.approved
</ns2:approvalStatus>
<ns2:approvalStateChangedDate>2013-08-16T07:28:13.889Z
</ns2:approvalStateChangedDate>
1) RQM version is 4.0.1
2) In our code we login as the approver first with j_security_check , and then use PUT to only update one approver approve status, we found whatever we want to change the approve status to(e.g. approved, rejected), the actual result is : it is changed to status 'pending'. That means if the approve status is rejected, after our code run, it is changed to 'pending'.
3) we verified that RQM api can only modify the approve status of logging, not other approvers. This is good for us.
ps:the format we change in code
<ns2:approvalStatus>com.ibm.team.workitem.approvalState.approved
</ns2:approvalStatus>
<ns2:approvalStateChangedDate>2013-08-16T07:28:13.889Z
</ns2:approvalStateChangedDate>
Thanks Paul for the support! With the kindly help, finally we resolved the issue successfully.
The content of http body which we pasted above is correct. However, we 'format' it after we GET the test plan and update the approval status. The 'format' operation add <lr> at the end of each line, which is not actually supported by RQM server. The RQM server then set the approval status to pending no matter what status it was. That's what the trouble we had;
2) the