It's all about the answers!

Ask a question

Unable to update the 'State' of an asset in RAM using REST API


Basavaraj Wadi (2314) | asked Jan 30 '13, 8:14 a.m.

I am using RAM 7.5.1. And REST API to modify the asset present in the RAM server.
I can't modify the state (ex: from 'Submitted' to 'Approve') of an asset using the REST API with POST/PUT method.

Are there any ways to modify the state of an asset using REST API?

Accepted answer


permanent link
Rich Kulp (3.6k38) | answered Jan 30 '13, 10:29 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Jan 30 '13, 11:21 a.m.
This is basically internal and hasn't been published as API but this is how it currently works. We don't see a change in the future at this time but we can't guarantee it.

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)

Basavaraj Wadi selected this answer as the correct answer

Comments
Basavaraj Wadi commented Feb 01 '13, 6:54 a.m.

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:statusCode>500</oslc:statusCode>

<oslc:message>
The conditions required to invoke the action have not been met

</oslc:message>


Gili Mendel commented Feb 01 '13, 8:58 a.m.
JAZZ DEVELOPER

What the logs (ramDebug.log) on the server for the 500 above?


Rich Kulp commented Feb 01 '13, 10:17 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

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.


Ashutosh Chaturvedi commented Feb 07 '13, 6:41 a.m.

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?


Gili Mendel commented Mar 07 '13, 11:20 a.m.
JAZZ DEVELOPER

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.


Pratap Singh Rathore commented Jun 10 '13, 1:00 a.m.

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.

showing 5 of 6 show 1 more comments

Your answer


Register or to post your answer.