RAM OSLC API: How can I update without changing the version?
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>
</oslc:statusCode>
500
<oslc:message>
</oslc:message>
Error PUTing asset Modified without version change[internal/assets/3F9330E1-1D5A-40D6-9A47-726370269C36/1.0] : Null pointer exception
4 answers
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.
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.
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.
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
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).
Comments
Rich Kulp
FORUM MODERATOR / JAZZ DEVELOPER Sep 11 '12, 11:11 a.m.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.