[closed] [EWM] add comments using API
I'm thinking of using OSLC (REST API) to add comments to my Workitem.
At this time, can I specify the comment user and the comment creation date?
Reference
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20#Adding_comments
The question has been closed for the following reason: "The question is answered, right answer was accepted" by davidhoney Apr 19 '23, 4:00 a.m.
Accepted answer
As far as I can tell, I have to agree with David.
As the creation date and the creator are automatically assigned, it is sufficient to POST the comment representation with just description in it to the collection url.
Comments
I see!
it is sufficient to POST the comment
When I read the word "sufficient to", I mistakenly thought it could be further customized.
With EWM Plain Java, it's amazing what we can do.
On a different thing, when updating an RTC in TASKTOP, it seems we can change the commenter to the intended user.
It means that we may be updating using RTC Plain Java.
For the Plain Java client Libraries, you can only set the creator using com.ibm.team.workitem.common.model.IWorkItem.setCreator(IContributorHandle).
Timestamp cDate = getWorkItem().getCreationDate(); if(cDate==null){ // CreationDate can only be set during work item creation. Object creationDate = calculateTimestamp(parameter); if(creationDate!=null){ getWorkItem().setCreationDate((Timestamp) creationDate); } }</pre> <div> <br> </div> <div> </div> creation date when you create the item using com.ibm.team.workitem.common.model.IWorkItem.setCreationDate(Timestamp)
That's right about the date of creation of work items.
When importing CSV with Eclipse, I use this omission.
I wish the comment date was the same, but what about it?
You should be able to look into the SDK as good as I can.
com.ibm.team.workitem.common.internal.model.impl.CommentImpl.class
One other answer
I think it unlikely. I would expect the creator of the comment to be the current authenticated user, and the creation time to be the time it was added to a comment. In other words, I would expect that any
dcterms:creator
and
dcterms:created
included in the POST request JSON body would be ignored. Allowing the REST API to spoof another user would be a security issue.
Comments
After all, yes.
It can also be a security breach such as impersonation.
But the page here seems to have descriptions that could be changed explicitly.
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Adding_a_Comment_to_a_Work_Item
If it is ignored, why are the procedures written separately?
I would like to change my username if possible.
The purpose is to move (copy) Workitems from the old RTC server to the new EWM server.
Moving comments is very difficult, so I am testing it in the hope that it can be done with the API.
As the creation date and the creator are automatically assigned, it is sufficient to post the description:
The spec you link to says "the creation date and the creator are automatically assigned" which implies you can't set them in the content, i.e. the content for creator is ignored.
I see, I was mistaken.
Thank you!
That's how it was written!
I didn't understand the context.