user1587852 user1587852 - 10 days ago 5
reST (reStructuredText) Question

Invoking JIRA Rest API to create an issue containing a locked custom fields like Epic Name

I'm trying to create an Epic Issue in JIRA using the REST API.

There is a field called "Epic Name", which is required and locked.
When I submit the following JSON
URL: https://jira:443/jira/rest/api/latest/issue

{"fields":{"project":{"key":"TEST"},"issuetype":{"name":"Epic"},"summary":"TestSummary","Epic Name":"TestName"}}


The Response is:

Http Error : 400{"errorMessages":[],"errors":{"Epic Name":"Field 'Epic Name' cannot be set. It is not on the appropriate screen, or unknown."}}


What is wrong, since in the screen Epic Name is there and required (obviously, since it is a required attribute). What could be the problem?

Thanks

Answer

The problem is not that the field is not on the screen but that for JIRA API, the field name Epic Name is invalid/unknown. The actual ID of that field is customfield_10016 which you have to put in the query. The value should be the Issue Key for that specific Epic instead of just a name.

{
    "fields": {
        //other data
        "customfield_10016": "PROJECTKEY-69"
    }
}