It's all about the answers!

Ask a question

RAM OSLC API: How can I update without changing the version?


Kangkan Goswami (15711621) | asked Aug 30 '12, 8:51 a.m.
edited Aug 30 '12, 10:36 a.m.
 I can update an asset using OSLC API following the steps as mentioned in  http://open-services.net/bin/view/Main/AssetMgRestApiV1

However, if I wish to keep the version same, it give Error 500 saying something like: "Error POSTing asset Modified without version change[internal/assets/3F9330E1-1D5A-40D6-9A47-726370269C36/1.0] : The asset stest11‎[1.0] already exists. External ID is 3F9330E1-1D5A-40D6-9A47-726370269C36 and database id is 1,498."

Am I missing something?

UPDATE:

I tried sending a PUT in place of POST and get the following error:

<oslc:statusCode>
500
</oslc:statusCode>
<oslc:message>
Error PUTing asset Modified without version change[internal/assets/3F9330E1-1D5A-40D6-9A47-726370269C36/1.0] : Null pointer exception
</oslc:message>


Comments
Rich Kulp commented Sep 11 '12, 11:11 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Is there a larger stacktrace attached to this OSLC return? You are getting an NPE on the host but we don't know where on the host it is happening?

You may need to get the host ramdebug logs at this point so we can see where the NPE is happening.

4 answers



permanent link
Rich Kulp (3.6k38) | answered Aug 30 '12, 10:08 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Updates are done through Put. Post is only for create.

Comments
Kangkan Goswami commented Aug 30 '12, 10:38 a.m.

@RichardKulp: I get a similar error when I send PUT in place of POST. Can you help?


permanent link
Gili Mendel (1.8k56) | answered Sep 10 '12, 8:49 a.m.
JAZZ DEVELOPER
Which version of OSLC are you using v1 or 2?

On a PUT, you need to make sure that the <ram_asset:revisionCount> value is proper.  This is how RAM determine if your PUT is stale or not.

... so for a test,  do a GET, and then do a PUT with the content from the GET.  If this works, than you have a good baseline to work from.  Note the on the PUT you will get the asset again, with a newer revision count.

Comments
Kangkan Goswami commented Sep 11 '12, 1:20 a.m.

@GiliMendel: We are doing what you are saying. I do a GET, change the title or description without changing the version and use a PUT.


Gili Mendel commented Sep 11 '12, 7:54 a.m.
JAZZ DEVELOPER

Which version or RAM / OSLC?

Try to also increment the revisioncount.


permanent link
Kangkan Goswami (15711621) | answered Sep 11 '12, 9:07 a.m.
RAM (the web interface) allows updating an asset without changing the version. I am trying to do the same using the OSLC API for RAM version 7.5.1

permanent link
Peter Walker (168136) | answered Sep 12 '12, 9:19 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
As Gili previously commented... "Try to also increment the revisioncount.".
The revision count is not the same as the RAM version. In order to do the PUT, you have to do the GET, then whatever the revisioncount is, try incrementing it and then do the PUT. The revisioncount is to ensure you are using the correct level of that asset and won't clobber over someone's previous changes.

Comments
Rich Kulp commented Sep 12 '12, 9:17 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

DO NOT update the revision count by hand.

The process is bring down asset xml, update what you want, and then put that back. It must have the same revision count as when it was brought down so that it can verify that the updates are based upon the current revision and not some other. If you update the revision count by hand it will no longer match what was brought down and so will not match the host and will be rejected.

After you do your update, if you want to do more, then you must bring the asset xml down again (though I think it may actually return the updated contents including the new revision count as the result of the PUT, if not then you will need to bring it down again).

Your answer


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