Populating `customfield_11331` using JIRA API in the POST method

19 Views Asked by At

I have field:

{
        "id": "customfield_11331",
        "key": "customfield_11331",
        "name": "Data Team",
        "untranslatedName": "Data Team",
        "custom": true,
        "orderable": true,
        "navigable": true,
        "searchable": true,
        "clauseNames": [
            "cf[11331]",
            "Data Team",
            "Data Team[Dropdown]"
        ],
        "schema": {
            "type": "option",
            "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
            "customId": 11331
        }
    }

It is a required field while creating an issue from the FrontEnd.

However, trying multiple things using the JIRA API, I am still stuck on the correct way to populate it during the POST API Call.

One of those methods was:

"customfield_11331": {
    "id": "customfield_11331",
    "value": "11344[Data Engineering]"
}

It gives:

{
    "errorMessages": [],
    "errors": {
        "customfield_11331": "Specify a valid value for 'Data Team'. The allowed values are 11343[Data Analysis], 11344[Data Engineering], 11345[Data Ops], 11346[Data Platform], 11347[Data Science], -1"
    }
}

However, for an already existing JIRA issue when I try to update its value, it works fine with the following Body:

{
    "fields" : {
        "customfield_11331": {
                "id": "11344"
       }
    }
}

The Basic Authentication is working fine. Are the any questions I may answer for better clarity?

Endpoint: https://mycompany.atlassian.net/rest/api/3/issue/

Body:

{
    "fields": {
        "project": {
            "key": "DW"
        },
        "summary": "Test Story to be closed",
        "description": {
            "type": "doc",
            "version": "1",
            "content": [
                {
                    "type": "paragraph",
                    "content": [
                        {
                            "type": "text",
                            "text": " description"
                        }
                    ]
                }
            ]
        },
        "issuetype": {
            "name": "Bug"
        },
        "customfield_11331": {
            "id": "customfield_11331",
            "value": "11344[Data Engineering]"
        }
    }
}

PS: I am using Postman for testing my REST API Calls.

0

There are 0 best solutions below