Query related with DNG API's
- If we want to update anything in DNG Module, we need to create a changeset, so does it mean if i try to programmatically update any module artifact data, do i need to first create a DNG Changeset programmatically and then only i can update the artifact data?
- if Changeset creation is not required then what if i update the artifact in DNG and at the same time some other user is working in same module (under same stream) with open changeset, then will my changes (which i have done using API) will go and sit in his/her changeset changed resources history?
2 answers
Rajat,
In addition the DNG Server API e.g. for delivery: https://jazz.net/wiki/bin/view/Main/DNGServerAPI
As a summary
If you want to deliver something, you need to provide the source and the target configuration. If a change set is required, you have to create a changeset and do the changes related to this change set. The API will not pick up an arbitrary configuration.
Note, as discussed in https://jazz.net/library/article/92596 the change set API is public, but unfortunately undocumented. You can trace the code and how it works.
Comments
Please also note that the error handling support in general e.g. for the Configuration Management API leaves much to be desired. I do not think you can do much programmatically if the operation fails. Even the error messages are so generic, it does not help much.
I would suggest to create ideas/enhancement requests if you want more/different API. If there is enough demand, it would be possible to enhance the APIs.
Currently, the OSLC Configuration Management specification does not define any mechanisms for delivering change sets, or findinfg the history of such deliveries (e.g. find all the change sets delivered to a specified stream). The OSLC Open Projects Work Group has recently discussed changes to the OSLC Configuration Management specification address these gaps. I recommend anyone interested in this topic participate in the discussions by joining the OSLC Open Projects group - see https://lists.oasis-open-projects.org/g/oslc-op and https://open-services.net/contribute/ for more information.
> If we want to update anything in DNG Module, we need to create a changeset, so does it mean if i try to programmatically update any module artifact data, do i need to first create a DNG Changeset programmatically and then only i can update the artifact data?
- When you GET the artifact content to retrieve attribute values that you're going to modify later, you also get an etag - this changes whenever the artifact is modified.
- When you modify the content and do the PUT you have to provide the etag value you retrieved in the header if-match and the server checks if the artifact has been updated since you did the GET then the result will be a 412 precondition failed. You must decide how your code should handle this. One way of handling it could be to somehow stop and notify the user, or another way would be to repeat the GET (i.e. get the latest values and latest etag) and then redo the updates and do PUT again with the new etag.