代码 :
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)
輸出 :{"errorMessages":["\'accountId\'必须是GDPR严格模式下唯一的用户识别查询参数。"], "errors":{}}。
引用docs api文档。https:/docs.atlassian.comsoftwarejiradocsapiREST7.12.0#api2project-createProject。
虽然详细的文档似乎很有限,但在 GDPR
在今天的世界里,你被期望使用 leadAccountId
字段。至于这个字段的值,你可以用API来查询,也可以取这个人的权限页的最后一个URL元素(类似于 https://<yoursite>.atlassian.net/jira/people/<accountId>
)