1
"ket": "DEMOCREATE",
    "name":"DEMO ",
    "projectTypeKey":"business",
    "projectTemplateKey":"com.atlassian.jira-core-project-templates:jira-core-simplified-procurement",
    "description":"Rest Demo Project",
    "leadAccountId":"",
    "url":"",
    "assigneeType":"PROJECT_LEAD",
    "avatarId":1250
}

Tried to create a project using python rest-api and tested in the postman got 404 error, wants tp know what are the exact thing that have to fill in the "leadAccountId":"", "url":"",, your text and want to know what are fields mandatory while creating project or issue for json objects?

2
  • Are you using the JIRA Rest API then using Python to call those APIs, OR are using a certain Python package specifically for JIRA? If you are using a Python package, which one exactly? Because you tagged your question with both jira-rest-api and python-jira, which would result in 2 different implementations. Have you checked either of the linked documentation? Commented Oct 29, 2023 at 11:30
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Oct 29, 2023 at 11:32

1 Answer 1

0

The solution is described here:

# 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/project"

auth = HTTPBasicAuth("[email protected]", "<api_token>")

headers = {
  "Accept": "application/json",
  "Content-Type": "application/json"
}

payload = json.dumps( {
  "assigneeType": "PROJECT_LEAD",
  "avatarId": 10200,
  "categoryId": 10120,
  "description": "Cloud migration initiative",
  "issueSecurityScheme": 10001,
  "key": "EX",
  "leadAccountId": "5b10a0effa615349cb016cd8",
  "name": "Example",
  "notificationScheme": 10021,
  "permissionScheme": 10011,
  "projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-simplified-process-control",
  "projectTypeKey": "business",
  "url": "http://atlassian.com"
} )

response = requests.request(
   "POST",
   url,
   data=payload,
   headers=headers,
   auth=auth
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.