Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Set organization when creating ticket via API call

Jeroen Gouma January 24, 2023

I'm creating issue via API call in Jira Service Management which works fine.

Now I want to add the organization on moment of creation, but can not get this working. I figured out that customfield_10500 is holding the organization, but trying to set in via the API call keeps ending in the following error:

{"errorMessages":[],"errors":{"customfield_10500":"The Organization ID must be a number"}}

My (sanitized) API-call:

curl --request POST \
--url 'https://xxxxxxx.atlassian.net/rest/api/3/issue' \
-H "Authorization: Basic xxxxxxx" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"fields": {
"summary": "This is createdvia an API call",
"issuetype": {
"id": "10285"
},
"project": {
"key": "xxx"
},
"customfield_10500": [
{
"ID": 4
}
],
}
}'

I tried to put the organization id between quotes, square brackets and using the name. But no luck until now.

Once the issue is created I can set the organization manual, but that is a manual intervention I want to avoid :-)

1 answer

1 accepted

3 votes
Answer accepted
Prince Nyeche
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.
January 24, 2023

You need to set the id in an array as a number. The organization field is capable of containing other organization values, so as an array it just needs the value of the organization id. e.g

--data '{
"fields": {
"summary": "This is createdvia an API call",
"issuetype": {
"id": "10285"
},
"project": {
"key": "xxx"
},
"customfield_10500": [4]
}
}'
Jeroen Gouma January 24, 2023

Thanks a lot, this solved my issue!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events