REST API Use with cURL

Fariha Raza June 21, 2021

I'm new to APIs and how it is implemented in Jira. I've read the articles online, but I am having some issues accessing the localhost. How can I use the API with cURL to create an issue?

1 answer

0 votes
Hyrum Steffensen _Appfire_
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 21, 2021

Hello Fariha,

See this REST API documentation on creating an issue. Create a an API token here. I found it easies to use Postman to generate the authorization hash. Choose basic authorization and enter your Atlassian username and API token. See this on generating curl code in Postman.

A basic curl script looks something like:

curl --location --request POST 'https://<your prefix here>.atlassian.net/rest/api/2/issue' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <auth hash goes here>' \
--data-raw '{
"fields": {
"summary": "summary goes here",
"issuetype": {
"id": "10002"
},
"project": {
"id": "10000"
}
}
}'

Please let the Community know how it goes.

Regards,

Hyrum

Fariha Raza June 22, 2021

Thanks for the response! I have created a token. I'm running into the issue where the localhost is not being found when I put in that. For instance, when I press "Send" in Postman, it says "Could not get any response." Is this an issue with not having started Jira or something?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events