I am trying to loop through all the issues in one repo, and then remove the parent epic link from one of them. This code doesn’t remove the parent link, but I’m not sure why. Does anyone know what changes I need?
Thanks
Wally
import requests
url = "https://gitlab.com/api/v4/projects/8675309/issues"
payload = {}
headers = {
'PRIVATE-TOKEN': 'glpat-xxxxxxxxxxxxxxxxxxxx’
}
response = requests.request("GET", url, headers=headers, data=payload,params={"per_page": 100})
issues = response.json()
for issue in issues:
issue_iid = issue['iid']
issue_title = issue['title']
parent = issue.get('epic_iid')
if parent:
print(f"Issue #{issue_iid}: {issue_title}")
print(f"\033[31m ↳ Parent ID: {parent}\033[0m")
put_url = "https://gitlab.com/api/v4/projects/8675309/issues/12"
#PUT /projects/:id/issues/:issue_iid
#Remove Epic connection
payload = {
"id" : “4212345,
"iid" : "12",
"confidential": "False",
#"epic_iid" : "null",
"epic":{
#"id" : "null",
"iid" : "null"
}
}
response = requests.put(put_url, headers=headers, json=payload)