Unable to update the 'State' of an asset in RAM using REST API
Accepted answer
Now I haven't done this but the basics according to the code is you need to:
1) Get the available actions for the asset in the current state.
2) Decide on the action you want to do.
3) Do a REST PUT with the action as a parameter to actually cause the update to occur to the next state.
0) -- GET ...internal/assets/{3691A889-9D1C-17BA-6EEB-DD5FB50FA2E6}/4.0
with Accept header set to "application/xml" or "application/json" which ever you prefer
1) -- GET ...internal/assets/{3691A889-9D1C-17BA-6EEB-DD5FB50FA2E6}/4.0/availableActions
with Accept header set to "application/xml" or "application/json" which ever you prefer
2) -- Go through the results to get the desired action
3) -- PUT ...internal/assets/{3691A889-9D1C-17BA-6EEB-DD5FB50FA2E6}/4.0
with "action" header set to the action id that you choose from (2) and
with ContentType header set to "application/xml" or "application/json" which ever you prefer
with content sent being the same content as returned from (0).
Note also that there is a defect around driving a retire from API: Java API to retire an asset (drive the Retire action) will not work properly (79583)
Comments
Hi Richard, ThanksĀ for your reply...
I tried the steps you mentioned above using the REST client and i got the following error (and I used 'application/xml' and Action:Publish as header):
<oslc:message>
The conditions required to invoke the action have not been met
</oslc:message> |
What the logs (ramDebug.log) on the server for the 500 above?
The logs should give more info, but that basically means that your lifecycle for that asset is configured to require some other condition, like maybe a reviewer voting on it, before the action is allowed to be performed.
You can go to the asset on the web page and on the review tab it should tell you what is needed before the action can be performed.
Hi Richard,
I am facing the same problem to change the state, because reviewer voting condition is added as mandatory to change the state of the asset.
Is it possible to change the state by Vote using REST API?
API can not override a criteria set on your lifecycle.... you will need to either meet the criteria, or modify it to be able to transition to the next state.
Is this API available for version 7.2, I am also trying to change the state but nothing is happening, nor I am getting any error.
I have added action header with the action id value as mentioned in the above post but not getting the desired result. Am I missing something here.