Unable to update the 'State' of an asset in RAM using REST API
Accepted answer
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)
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
showing 5 of 6
show 1 more comments