Closed markplindsay closed 5 years ago
@markplindsay You have several things working against you to make this happen.
From the documentation you should be able to create a project without a template. If that is currently a limitation then you would need to try the other solutions I provided.
Hi @ddavisqa, thanks for the response and advice! I ended up using requests
directly to create a project, in case this issue ends up in anyone's Google search:
import json
import os
import requests
data = json.dumps({
'assigneeType': 'UNASSIGNED',
'key': 'OC',
'lead': 'me',
'name': 'Project Name',
'projectTemplateKey': \
'com.pyxis.greenhopper.jira:gh-simplified-scrum-classic',
'projectTypeKey': 'software',
})
s = requests.Session()
s.auth = (
os.environ['JIRA_API_USERNAME'],
os.environ['JIRA_API_TOKEN'],
)
s.headers.update({
'Accept': 'application/json',
'Content-Type': 'application/json',
})
response = s.request(
data=data,
method='POST',
url='{}/rest/api/3/project'.format(os.environ['JIRA_API_ROOT']),
)
Describe the bug
I try to use
create_project
on my JIRA Cloud site, but I receive aJIRAError HTTP 500
with textThe referenced project template was not found - the project has not been created
To Reproduce
jira
package installed (I havejira==2.0.0
)URL = 'https://myemployer.atlassian.net' EMAIL = 'me@myemployer.com' JIRA_API_TOKEN = 'mytoken'
jira = JIRA(URL, basic_auth=(EMAIL, JIRA_API_TOKEN)) project = jira.create_project('OC')
Traceback (most recent call last): File "application.py", line 14, in
project = jira.create_project('OC')
File "/usr/local/lib/python3.7/site-packages/jira/client.py", line 2914, in create_project
r = self._session.post(url, data=payload, headers=headers)
File "/usr/local/lib/python3.7/site-packages/jira/resilientsession.py", line 154, in post
return self.verb('POST', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/jira/resilientsession.py", line 147, in verb
raise_on_error(response, verb=verb, kwargs)
File "/usr/local/lib/python3.7/site-packages/jira/resilientsession.py", line 57, in raise_on_error
r.status_code, error, r.url, request=request, response=r, kwargs)
jira.exceptions.JIRAError: JiraError HTTP 500 url: https://myemployer.atlassian.net/rest/project-templates/latest/templates
text: The referenced project template was not found - the project has not been created.
I am new to JIRA and this library, so my apologies in advance if this is actually a permissions problem or misconfiguration of https://myemployer.atlassian.net. However, I have no trouble creating projects with this same user within the web UI. The user has every admin permission I could find in the web UI, although I certainly could've missed something because I am so new to the platform.
Any suggestions of things to try would be greatly appreciated!