I am trying to write a quick script that creates a Jira project using the REST API. This code, taken from the docs (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-post) is returning status 200 - instead of 201, and no new project is being created.
I'm pretty confident that I have set up everything correctly jira-side w.r.t. global permissions, etc. (my account is an admin with full access).
Any ideas why this might be happening?
The Code (Python)
Note: Text in bold has been replaced for confidentiality reasons.
import requests
from requests.auth import HTTPBasicAuth
import json
url = "http://domain.atlassian.net/rest/api/3/project"
auth = HTTPBasicAuth("email", "api key")
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.dumps( {
"notificationScheme": 10021,
"description": "Example Project description",
"leadAccountId": "my account ID",
"url": "http://atlassian.com",
"projectTemplateKey": "com.pyxis.greenhopper.jira:gh-simplified-scrum-classic",
"avatarId": 10200,
"issueSecurityScheme": 10001,
"name": "Example",
"permissionScheme": 10011,
"assigneeType": "PROJECT_LEAD",
"projectTypeKey": "software",
"key": "EXIT",
} )
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)
print(response) #returns <Response[200]>
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Hello @Peter Jupp
Welcome to the Atlassian Community!
The structure of your REST API call seems to be correct to me, however, there are a few background data that I would like to doublecheck with you to confirm we are on the same page here.
That being said, please check the steps below:
Let us know if you have any other questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.