Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Always getting message "Specify a valid project ID or key" can i create the issue with free version?

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=(",", ": ")))

1 answer

1 vote

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Next level incident management in Jira Service Management

Hello Atlassian Community! We’re thrilled to announce some exciting changes to incident management in Jira Service Management Cloud, in order to give your teams extra muscle during incidents, and ...

1,634 views 20 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you