Is there any way to discover the valid actions for a state via the REST API?
The title sums it up. I've been able to divine the means to discover actions leading to a state (https://[server]/ccm/oslc/workflows/[Project UUID]/actions/[workflow]) but I am at a loss on how to determine which actions can be performed from a given state.
The most helpful answer I was able to find wasn't able to answer how it can be done via the REST API. Is it not implemented?
(For reference, this is using RTC v4.0.6)
|
One answer
I think I've find a way to determine which actions can be performed from a given state using RTC's reportable REST API and a "http get" to a resource (I don't know if it can be called a REST or an OSLC call).
I did a test using RTC 5.0.2 and MSXML in an MS-Excel module and, apparently, it worked.
If it work to you too, please, let me know.
- First, we get the contentId of the process configuration using Reportable REST API .
- For example, to the 'JUnit Project' sample project area, we call "https://<server-name>:9443/ccm/rpt/repository/generic?fields=generic/com.ibm.team.process.ProjectArea[name='JUnit Project']/processData[key='com.ibm.team.internal.process.compiled.xml']/value/contentId".
- Let's say that the result was "_R7wEwPn7EeWpjbQPCeBbyw"
- Then, we get the process configuration doing a "http get" in "https://<server-name>/9443/ccm/resource/content/_R7wEwPn7EeWpjbQPCeBbyw", passing JSESSIONID in "X-Jazz-CSRF-Prevent" request header and "application/xml" in "Accept" request header.
- If we are looking for all possible actions from a state of the task workitem type, and ...
- If we already know the workflow id, we can look for the "workflowDefinition" tag with id attribute is the desired workflow. For example, "com.ibm.team.workitem.taskWorkFlow".
- If we don't know the workflow id, we can look for <configuration-data id=com.ibm.team.workitem.configuration.workflowBinding>/<workItemCategoryBinding workItemCategoryId="com.ibm.team.workitem.workItemType.task"> and get the "workflowId" attribute there.
- From "workflowDefinition", I think that the "workflow" child has "state" children, who has "action" childs that can be performed by each state.
- Remember: to save a workitem, we need to supply the required attributes, has the correct role, and do all that is explained in https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20, topic "Resource Operations".
- To know the required attributes, we look in the process configuration for <behavior>/<role id='roleid'>/<operation id=com.ibm.team.workitem.operation.workItemSave>/<precondition id=com.ibm.team.workitem.advisor.requiredProperties>/<properties workItemTypeCategory='workItemTypeCategory'>/<property> tags and get the "id" attribute.
- If we don't know what means that "id" attribute in terms of OSLC tags, I think that we can do a Reportable Rest http call to discovery its <displayName> and then look this in <dcterms:title> of the resource shape properties of that given workitem type.
- For example, let's say that the required attribute id was "com.ibm.team.workitem.attribute.summary", so, we can look for the "summary" attribute, doing this by calling https://<server-name>:9443/ccm/rpt/repository/generic?fields=generic/com.ibm.team.workitem.Attribute[projectArea/name='JUnit Project' and identifier=summary]/displayName.
- To get the resource shape, see the instructions in https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20.
- I apologize if wrote too much, but, like you, I find no other means, answers, articles, documentation or tip to know all possible actions for a given state using Reportable REST Api and/or OSLC, and this drives me crazy to find an answer.
Best Regards
André
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.