Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Java Rest Client - Add History

Udhayakumar Uthamarajan February 3, 2020

Hi,

 

My objective is, create a new issue using an existing one under different project.

I retrieved the existing issue details like attachment, comment, change log group,etc..

I am able to add comments, attachments, version to new issue.

But am not sure how to add History (Change Log) to newly created issue using the change log group retrieved from existing issue.

 

 Issue issueHistory = restClient.getIssueClient().getIssue(existingIssue.getKey(),Arrays.asList(IssueRestClient.Expandos.CHANGELOG)).claim();

 

I used the above code to get the change log...

But i don't know how to add the same to new issue...

Could you please help me to resolve this?

Regards

 

1 answer

1 accepted

0 votes
Answer accepted
Thomas Deiler
Community Champion
February 3, 2020

Dear @Udhayakumar Uthamarajan ,

to be honest, the API restricts modification of the history (changelog). When you create new issues, they start with an empty history.

With other words - you can't do what you want.

So long

Thomas

Udhayakumar Uthamarajan February 3, 2020

Thanks Thomas...

Need one more clarification on Transition...

I am doing the following to get the transition...

 

final Iterable<Transition> existingTransitionIterable = restClient.getIssueClient().getTransitions(existingIssue).get();

existingTransitionIterable.forEach(transition -> {
final TransitionInput transitionInput = new TransitionInput(transition.getId());
restClient.getIssueClient().transition(modifiedTransitionURI, transitionInput);
});

 

But i am not getting existing transition information...

 

Could you please help on this?

Thomas Deiler
Community Champion
February 3, 2020

Dear @Udhayakumar Uthamarajan ,

I am not familiar with the Rest Client - just with the pure REST API itself. When you want to perform a transition, you need to "Get transitions" first. In the response is a list of all transitions the requesting user can perform right now. You need to extract the ID so that you can "Do transition".

So long

Thomas

Like Udhayakumar Uthamarajan likes this

Suggest an answer

Log in or Sign up to answer