Forums

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

how to update the parent field of an issue with API

N_O
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 9, 2024

Hi, with the new changes to the parent field. I do not see any documentation to update (also remove) the parent linked to an issue. Is this possible via the API if not how do we do this as I am getting unexpected results from the API? is /rest/api/latest/issue the right endpoint? I have tried setting this field's value to null but that doesn't work

1 answer

1 accepted

6 votes
Answer accepted
Sunny Ape
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 9, 2024

Hello @N_O 

The Edit Issue endpoint is working just fine for me.

To change a particular Story's parent Epic, I send the following request:

PUT https://{Instance}.atlassian.net/rest/api/3/issue/KEY-123

with the following request body:

{
 "fields": {
  "parent": {
   "key": "KEY-234"
   }
  }
}

then that Story gets a different parent Epic.

If I set the parent field to null:

{
 "fields": {
  "parent": {
   "key": null
   }
  }
}

then that Story has no Epic.

DaYuan Tan January 10, 2024

Can I update/add?

DaYuan Tan January 10, 2024

I tried { "update": { "parent": [ { "set": { "key": "parent_issue_key" } } ] } }

or

{ "update": { "parent": [ { "add": { "key": "parent_issue_key" } } ] } }

 

they both don't work.

 

I am doing it in Microsoft Power Automate calling Rest API Edit issue V2.

Sunny Ape
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 10, 2024

Hello @DaYuan Tan 

Can I update/add?

No. Updating / adding is for other field types that can accept multiple actions / values via multiple sets or adds inside an array[ ] in the JSON body.

For the parent field, it can accept only a single value, so you need to declare the value for the key, exactly as I've shown in my example.

N_O
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 22, 2024

@Sunny Ape Thank you

Sunny Ape
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 22, 2024

@N_O 

If my answer was correct, can you please mark it as such.

Thanks

Subhasish Karmakar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 7, 2024

Hi @Sunny Ape I am facing a similar issue so we have a job for creating JIRA tickets earlier it was linked to epic id now I would like to link it with parent id

Here is the previous request

req_body["fields"]['customfield_10014'] = env_jira_config.get('epic_id')
this is the error message
"errorMessages": [], "errors": { "customfield_10014": "Field 'customfield_10014' cannot be set. It is not on the appropriate screen, or unknown." } }

Updated the request like these
1. req_body["fields"]['customfield_10017'] = env_jira_config.get('epic_id')
2. req_body['fields']['parent']['key'] = env_jira_config.get('epic_id')
3. req_body['fields']['960298'] = env_jira_config.get('epic_id') 
4.  req_body['960298'] = env_jira_config.get('epic_id')    
in case of 1,3,4 the tickets are getting created but not getting linked to parent id      

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events