Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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?

2 votes


Accepted answer

Permanent link
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

0 votes

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

<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.

showing 5 of 6 show 1 more comments

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jan 30 '13, 8:14 a.m.

Question was seen: 4,671 times

Last updated: Jun 10 '13, 1:00 a.m.

Confirmation Cancel Confirm