This is my code
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 5 22:39:01 2022
@author: 10077269
"""
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
from requests.auth import HTTPBasicAuth
import json
url = "https://your-domain.atlassian.net/rest/api/3/issue"
auth = HTTPBasicAuth("xxxxx", "xxxxx")
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
'X-Atlassian-Token': 'no-check'
}
payload = json.dumps( {
"update": {},
"fields": {
"summary": "Main order flow broken",
"parent": {
"key": "AT"
},
"issuetype": {
"id": "10001"
},
"components": [
{
"id": "10001"
}
],
"customfield_20000": "06/Jul/19 3:25 PM",
"customfield_40000": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Occurs on all orders",
"type": "text"
}
]
}
]
},
"customfield_70000": [
"jira-administrators",
"jira-software-users"
],
"project": {
"id": "101"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Order entry fails when selecting supplier.",
"type": "text"
}
]
}
]
},
"reporter": {
"id": "5b10a2844c20165700ede21g"
},
"fixVersions": [
{
"id": "10001"
}
],
"customfield_10000": "09/Jun/21",
"priority": {
"id": "20000"
},
"labels": [
"bugfix",
"blitz_test"
],
"timetracking": {
"remainingEstimate": "5",
"originalEstimate": "10"
},
"customfield_30000": [
"10000",
"10002"
],
"customfield_80000": {
"value": "red"
},
"security": {
"id": "10000"
},
"environment": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "UAT",
"type": "text"
}
]
}
]
},
"versions": [
{
"id": "10000"
}
],
"duedate": "2019-05-11",
"customfield_60000": "jira-software-users",
"customfield_50000": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Could impact day-to-day work.",
"type": "text"
}
]
}
]
},
"assignee": {
"id": "5b109f2e9729b51b54dc274d"
}
}
} )
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)
print(response.status_code)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
What is the "Key = AT" in your data supposed to be?
At a glance, it looks like you are trying to create a sub-task of another issue, in which case, you need to specify which issue the sub-task is a part of. That means giving it the full key of the parent, not just the project key.
If you're just trying to create an issue, and not a sub-task, then you don't need a parent section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.