Forums

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

Does Jira Rest API have idempotent create Jira ticket API?

xdd1874
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 6, 2023

My system integrates Jira. When the user calls my API, because the response of create jira is too slow, I set a timeout period. If this time is exceeded, I will return an error, but the Jira ticket will be created successfully, and the user will be sent again Calling my API will create multiple Jira tickets. I am thinking, does Jira have an idempotent creation API? I call it many times and still only create one. I need this function.

1 answer

0 votes
Radek Dostál
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.
June 6, 2023

The first question I have is why do you implement a custom/different timeout than the endpoint? What is the logical reason to do that?

Second, why would the issue creation need a custom timeout to begin with, isn't it more suspicious for it to take "that" long (no idea how long)?

Third, no, you're not creating an issue by issue key, you're creating an issue with issue details. To prevent creating a duplicate, you would need to perform a lookup for the issue (e.g. JQL search, but this is risky and prone to fail in case of multiple nodes, if your indexes are lagging behind), alternative could be w/ java API if you had created a custom endpoint. Then, you could potentially do a fully cluster-safe implementation, but that would be one hell of a ride if we are talking about a full "idempotence" - multiple clients/requests trying to create an issue simultaneously since you only would want a single one of those requests to go through, while the others are waiting for the first one's result. I mean, that sounds like such a whiff for something which should not be needed in the first place.

I don't have an idea why you would decide to implement a lower/custom timeout from the original endpoint, when you are just forwarding the request to it, but that sounds like the cause to me here.

Nicholas Lydon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 2, 2025

I just asked this question here https://community.developer.atlassian.com/t/how-do-i-ensure-issue-creation-is-idempotent/93517

(I'm not sure what the difference is between the two forums).

@Radek Dostál it's very common to implement idempotent APIs. Any failure could happen between Jira creating the issue and the client recording the created issue id, so the process needs to be repeatable, i.e. with retry mechanisms. 
The common solution is to add a parameter to the request for a unique identifier. This "idempotency key" would have a unique constraint in the database.

If the search is not guaranteed to return the latest updates to the database, then it appears there is no solution.

 

Radek Dostál
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.
July 2, 2025

You would need your own endpoint to handle the task creation. Jira out of box doesn't care, 2 requests means 2 issues.

With a custom endpoint you can do cluster locks and/or use the db, so the answer pretty much is you'd need a plugin in Jira.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events