Create an Issue with Epic as parent using REST API

Vijay Gopu June 18, 2020

Hi,

I am able to create an Epic using REST api. But unable to create issue under the created EPIC? How do i do this?

 

EPIC: [Success]

POST : /rest/api/2/issue

Request:

{
"fields": {
"project":{"key": "JIRA PROJECT"},
"summary": "Customer : Customer Name",
"description": "[TEST] : Creating of an issue using project keys and issue type names using the REST API",
"issuetype": {"name": "Epic"},
"customfield_10008": "Customer : Customer Name"
}
}

Issue: [Failed]

POST : /rest/api/2/issuetype

Request:

{
"fields":{
"project":{"key": "JIRA PROJECT"},
"parent": {"key": "JIRA PROJECT-1336"},
"summary": "Application Name: Customer Name",
"description": "Don't forget to do this too.",
"issuetype": {"name": "Project"}
}
}

Exception:

{    "errorMessages": [        "Unrecognized field \"fields\" (Class com.atlassian.jira.issue.fields.rest.json.beans.IssueTypeCreateBean), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@344973c6; line: 3, column: 6] (through reference chain: com.atlassian.jira.issue.fields.rest.json.beans.IssueTypeCreateBean[\"fields\"])"    ]}

 

Also if i change the URI to /rest/api/2/issue then i get a different exception:

{    "errorMessages": [],    "errors": {        "issuetype": "Issue type 11100 is not a sub-task but a parent is specified."    }}

 

1. Why is that i am able to create the an issue under Epic using the user interface but not via the REST api?

 

2. Is this a permission issue or am i doing something wrong. I couldn't figure out. I got the full access for the project to create any type of ticket.

Please let me know.

Thank you,

Vijay

 

 

 

 

 

 

2 answers

1 accepted

4 votes
Answer accepted
Najjar _Innovura_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
June 18, 2020

Issue in epic are not considered subtasks of epic

Jira has a Customfield named Epic Link

If you would like to create an issue under an epic, the child issue of the epic should have epic link custom field value with the epic key

 

Note, Parent is only used for creating subtakss

Vijay Gopu June 22, 2020

Hi @Najjar _Innovura_ ,

 

Would you be able to share a simple example on how to do this?

 

Thank you,

Vijay

Najjar _Innovura_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
June 22, 2020
curl --location --request POST 'http://localhost:2990/jira/rest/api/2/issue' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw '{
    "fields"{
        "project"{
            "id""10000"
        },
        "summary""something'\''s wrong",
        "issuetype"{
            "id""10000"
        },
        "assignee"{
            "name""admin"
        },
        "customfield_10102""JIRA-41"
    }
}'

In my jira instance custom field "Epic Link" id is 10102

Vijay Gopu June 22, 2020

Thank you @Najjar _Innovura_ . Apparently the customfield can differ is what i found based on this link here

What i received using the REST call is that "Epic Link" in my implementation is "customfield_10007"

URI: /rest/api/2/field

Response Snippet:

{
"id": "customfield_10007",
"key": "customfield_10007",
"name": "Epic Link",
"untranslatedName": "Epic Link",
"custom": true,
"orderable": true,
"navigable": true,
"searchable": true,
"clauseNames": [
"cf[10007]",
"Epic Link"
],
"schema": {
"type": "any",
"custom": "com.pyxis.greenhopper.jira:gh-epic-link",
"customId": 10007
}
}

Najjar _Innovura_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
June 22, 2020

Yes epic link defers from instance to instance. your json should look like this:


    
"fields"{
        "project"{
            "id""10000"
        },
        "summary""something'\''s wrong",
        "issuetype"{
            "id""10000"
        },
        "assignee"{
            "name""admin"
        },
        "customfield_10007""EPIC_KEY_HERE"
    }
Vijay Gopu June 22, 2020

Thank you @Najjar _Innovura_ I will give this a try. 

Regards.

Vijay Gopu June 24, 2020

Works!

Naeem March 3, 2022

@Najjar _Innovura_  hi, i am trying same, but i get this error
"Field 'customfield_10014' cannot be set. It is not on the appropriate screen, or unknown."
can you help me with this? thanks

Ben Upham June 10, 2022

Ditto, getting same error!

Lukasz Kalemba September 21, 2022

Same as above: 

Field 'customfield_10101' cannot be set. It is not on the appropriate screen, or unknown. 

0 votes
Vijay Gopu July 15, 2020

Where is the answer to this question? Why are you deleting answers in this forum? 

Vijay Gopu July 15, 2020

@Jack Brickey Do you happen to know Where the answers and discussions on this topic have been moved to? Why am i unable to see the previous discussion?

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2020

@Vijay Gopu , No answers have been deleted. There was an issue with the application that should be fixed at this point.

Vijay Gopu July 15, 2020

@Jack Brickey Thank you very much for the clarification and looking into this. Much Regards

Suggest an answer

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

Atlassian Community Events