3
votes

Code :

import requests
import json

client_id = "<client-id>"
access_token = "<access-token>"
url="https://api.atlassian.com/ex/jira/{0}/rest/api/2/project".format(client_id)
headers = {
           'Content-Type' : 'application/json',
             'Authorization' : 'Bearer {0}'.format(access_token),
       }

parameters= {
   "key": "EX",
   "name": "Example",
   "projectTypeKey": "business",
   "projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-project-management",
   "description": "Example Project description",
   "lead": "Charlie",
   "url": "http://atlassian.com",
   "assigneeType": "PROJECT_LEAD",
   "avatarId": 10200,
   "issueSecurityScheme": 10001,
   "permissionScheme": 10011,
   "notificationScheme": 10021,
   "categoryId": 10120
}

response = requests.post(url, headers = headers,data = json.dumps(parameters))
print(response)
print(response.content)

Output : {"errorMessages":["\'accountId\' must be the only user identifying query parameter in GDPR strict mode."],"errors":{}}

Referencedocs api docs : https://docs.atlassian.com/software/jira/docs/api/REST/7.12.0/#api/2/project-createProject

1

1 Answers

1
votes

While detailed documentation seems to be limited, in the GDPR world of today, you are expected to use the leadAccountId field. As for the value of this field, you can query it using the API or take the last URL element of the person's permission page (something like https://<yoursite>.atlassian.net/jira/people/<accountId>)