Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create Subtask thru API Error

Kei Ji September 26, 2021

Hi ,

I try to create a subtask with API but get the error:


Here is the code: 

subtask_dict = {
"project": {
"key": "IT"
},
"parent":{
"key":'IT-279058'
},
"summary": "Testing Subtask",
"issuetype": {
"name": "Sub-task"
},
"reporter": {
"name": "zji"
},
"labels": [
"bugfix",
"blitz_test"
],
"components" : [{'name':'ITPurchasing-Team'}],
Error:
response text = {"errorMessages":[],"errors":{"customfield_24109":"Please enter a purchase type"}}
----------------
So I try to add the customerfield_24109 and then get another error:
subtask_dict = {
"project": {
"key": "IT"
},
"parent":{
"key":'IT-279058'
},
"summary": "Testing Subtask",
"issuetype": {
"name": "Sub-task"
},
"reporter": {
"name": "zji"
},
"labels": [
"bugfix",
"blitz_test"
],
"components" : [{'name':'ITPurchasing-Team'}],
"customfield_24109": {'name':'software'}
}
Error:
response text = {"errorMessages":[],"errors":{"customfield_24109":"Could not find valid 'id' or 'value' in the Parent Option object."}}
Could you please help ?

2 answers

0 votes
Kishan Sharma
Community Champion
September 26, 2021

Hi @Kei Ji Welcome to the Atlassian Community!

Here's a sample example of how I created a subtask of issue type (id 10001) "Task" under my parent of type "Epic"

URL - POST https://yourdomain.atlassian.net/rest/api/2/issue

Headers:

Content-Type: application/json

Make sure authentication is present in the header

JSON Body -

{
"fields": {
"project": {
"key": "FIR"
},
"parent": {
"key": "FIR-10"
},
"summary": "Sub-task of FIR-10",
"description": "Test Description",
"issuetype": {
"id": "10001"
}
}
}
0 votes
Mohamed Adel
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.
September 26, 2021

Hi @Kei Ji 

Try that line instead

"customfield_24109": {'value':'software'}

 

Regards,

Mohamed Adel

Kei Ji September 26, 2021

Thanks @Mohamed Adel  !

I now got this error:

response text = {"errorMessages":[],"errors":{"customfield_24109":"Option id 'null' is not valid"}}

Kei Ji September 26, 2021

I have tried more time and change the software to Software and it works ! 

Thank you !!!!

Like Mohamed Adel likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events