无法在Jira中使用api创建项目,每当我尝试运行这个脚本时,我都会收到400错误代码。谁能帮我解决这个问题?

问题描述 投票:1回答:1

代码 :

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。

python jira jira-rest-api
1个回答
0
投票

虽然详细的文档似乎很有限,但在 GDPR 在今天的世界里,你被期望使用 leadAccountId 字段。至于这个字段的值,你可以用API来查询,也可以取这个人的权限页的最后一个URL元素(类似于 https://<yoursite>.atlassian.net/jira/people/<accountId>)

© www.soinside.com 2019 - 2024. All rights reserved.