unable to create a jira task under the epic

Arun Kumar June 14, 2022
curl --request POST \
--header 'Authorization: Basic YXJ1bmtAdG' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"fields": {
"summary": "test jira by api - arun",
"issuetype": {
"id": "3"               ### task id
},
"project": {
"key": "INIT"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "arun ticket",
"type": "text"
}
]
}
]
},
"customfield_10008": "INIT-2907"     ##epic link
}
}'



Error : {"errorMessages":[],"errors":{"issuetype":"The issue type selected is invalid."}}

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2022

This error message would tend to indicate that this issue type is invalid to create in that project.  Could you try to do the following GET to see what values are returned?

 

curl --request GET \ 
--url
'https://your-domain.atlassian.net/rest/api/3/project/INIT' \
--user
'email@example.com:<api_token>' \
--header
'Accept: application/json'

This query should be able to tell you the ID of the project.  With that number, you can then query which issuetypes can be created there in

curl --request GET \ 
--url
'https://your-domain.atlassian.net/rest/api/3/issuetype/project?projectId={projectId}' \
--header 'Authorization: Basic [encodedtoken]' \
--header
'Accept: application/json'

This can then give us the id of the issuetypes in that project. 

 

From there I'm interested to see if you can send a POST call to just create an issue of this type (even without trying to set the Epic in the issue create call).  Curious to learn more here.

Andy

Suggest an answer

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

Atlassian Community Events