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

[RTC] Is it possible to exclusively control work item updates by REST API(OSLC)?

I want to lock a Workitem when updating it using REST API.
Is it possible?


[APITool1]<---Get[RTC]<Lock>X<---PUT[APIToool2]

or

[APITool1]PUT(2nd)--->X<refuse>[RTC]<---PUT(1st)[APIToool2]

0 votes


Accepted answer

Permanent link

As far as I can tell, 

  1. There is no locking mechanism. 
  2. Regardless of how you implement it, REST or JAVA API, there are only limited options. You can detect a possible conflict e.g. based on the error when saving. In case there is an error, determine if this could be a stale data error. In case it is, refresh/reload the work item redo the modification and try to save again.
  3. A problem will be detected when saving - note that the Web UI has the same limitations, if a user works on a work item and another user saves this item while they do, there will be a save conflict.
  4. The Web UI check every now and then and shows a banner that says the work item has been changed - I don't know how that is implemented. I think it is irrelevant for automation, because the likely hood of a save conflict happening should be minimal and it would be possible to reload the item and retry.
  5. There is no other wonder API I am aware of. 



Ralph Schoon selected this answer as the correct answer

0 votes

Comments

Thanks Ralph.
However, I do not understand well.
What is “only limited options”?
Are there any articles I can learn?

In general locking is an even worse concept then not locking. If locks are not removed, they pose a higher risk of creating issues than having to redo an operation because of a racing condition.

There are many automation tools (and users) working against RTC servers. If it would be a problem I would have likely heard about it. 

 Summary, if you run into a racing condition, the tool detects the fact (based on some header information, I think [etag?]) and lets you know. Reread the work item, do the change again and try writing it again.

ETag!!

I understood a little.
Thank you very much.
Acquire that ETag is not changed after the session information and confirm that it matches.

I don't want to lock it if I imagine it would be impossible to unlock.

Let's consider a mechanism to check for updates even a little by checking with ETag.
I learned a lot.


One other answer

Permanent link
It looks like you can lock work items from the WebUI. I am not sure if you would be able to perform a work item update via REST API with the lock on, but this is one way to lock the state of the relevant work items.


Does this help?

0 votes

Comments

That is no lock, that is a pre-condition that prevents saving a work item under certain conditions.


As far as I am aware, there is no "locking" mechanism for work items. You can refresh before you do a change. If there is a conflict you get a stale data exception (in the java API) and you have to refetch and retry. 

Thanks Wark!!
But,this is for the control to close the WI, and is a good match for the process that prevents overwriting exclusively.


Thanks Ralph ,follow!!
Exactly,This is a conflict issue.

Can Java API detect conflicts?
I would like to do it with REST API, is it impossible?

As far as I can tell, there is no locking mechanism. Regardless of how you implement it, REST or JAVA API, there are only limited options. You can detect a possible conflict e.g. based on the error. In case there is an error, determine if this could be a stale data error. In case it is, refresh/reload the work item redo the modification and try to save again.

limited options?
Is there a “conflict check” API?
or
get "modified Date" and diff?

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
× 11,073

Question asked: Oct 22 '19, 8:23 p.m.

Question was seen: 2,569 times

Last updated: Oct 31 '19, 5:18 a.m.

Confirmation Cancel Confirm