Forums

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

issue in using jira swap api end point

sujoychakraborty93 May 6, 2019

I am creating multiple sprints (like 20 sprints) in one run using rest api . I can see that the id of the sprints were created sequentially like 100, 101, 102, 103 etc. But when i look into the board, they are not in order. For eg Sprint ID 102, Sprint ID 101, Sprint ID 103, Sprint ID 100 etc. I tried using the /rest/agile/1.0/sprint/{sprintId}/swap api, but irrespective of the number of ways i tried, reordering them in 100, 101, 102, 103.. is not happening. Using the swap api does do something, but i never understood what exactly it does. Appreciate your help in explaining if the swap api (/rest/agile/1.0/sprint/{sprintId}/swap) will work and if yes, how to make it work? And if not, then any alternative? 

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 6, 2019

Could you expand on what you expect from the "swap api", specifically what you expect it to do differently to the documentation?

sujoychakraborty93 May 8, 2019

HI @Nic Brough -Adaptavist- , 

What is see today when i open the board - 

Sprint 102
Sprint 101
Sprint 103
Sprint 100 etc. 

What i expect to see is 

Sprint 100
Sprint 101
Sprint 102
Sprint 103 ...

i.e. i want to see the sprints in sequence. 

Code i am using is 

1) for Sprint 100 - 
posturl = <myurl> + '/rest/agile/1.0/sprint/<Sprint 100 id>/swap'
and Body - 
swapData = {
"sprintToSwapWith": 1
}

2) for Sprint 101 - 
posturl = <myurl> + '/rest/agile/1.0/sprint/<Sprint 101 id>/swap'
and Body - 
swapData = {
"sprintToSwapWith": 2
}

3) for Sprint 102 - 
posturl = <myurl> + '/rest/agile/1.0/sprint/<Sprint 102 id>/swap'
and Body - 
swapData = {
"sprintToSwapWith": 3
}

4) for Sprint 103 - 
posturl = <myurl> + '/rest/agile/1.0/sprint/<Sprint 103 id>/swap'
and Body - 
swapData = {
"sprintToSwapWith": 4
}

... and so on. 

Am i doing something wrong?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2019

What are the IDs of the sprints you are trying to swap?

sujoychakraborty93 May 8, 2019

hi @Nic Brough -Adaptavist- , 

The sprint ids are like 1050, 1051, 1052, 2053 etc. and the names are Sprint 100, Sprint 101, Sprint 102, Sprint 103 etc. 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2019

Ok, and are you using those id's when using "sprintToSwapWith", and not 1, 2, 3, 4 etc?

sujoychakraborty93 May 8, 2019

Hi @Nic Brough -Adaptavist- 

Yes, i tried that already, using ids and then I used sequences also, and it was not behaving correctly .. it was generating some wired sequencing

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2019

So, when I try this, I have my sprints re-order ok when I issue the calls to rearrange them.

What error messages are you getting?

sujoychakraborty93 May 9, 2019

Hi @Nic Brough -Adaptavist- , Its working. Thanks a lot. There was no error message at all even in my first trial. Just that the result sequencing was illogical it seemed at first. But playing with it a bit longer did give the expected result. Thanks again!

To explain the problem that i was facing - its just how jira creates 'id' of a sprint. It took me some time to understand that. The ids are not always generated in sequence. For eg if Sprint 100 was created with 'id' of 1001, Sprint 2 can have 'id' of 1002 or even 990. Seems internal logic of Jira to assign ids. 

But now its good. Thanks for all your help!

Suggest an answer

Log in or Sign up to answer