我使用 rest/api/2 来做一些关于 jira 仪表盘的工作。
但是当我尝试复制仪表板时,它总是不好。
我的整个代码是:
import requests
from requests.auth import HTTPBasicAuth
import json
def auth(name, password):
return HTTPBasicAuth(name, password)
def copy_dashboard(auth, id, name):
url = f"https://jira.xxx.com/rest/api/2/dashboard/{id}/copy"
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.dumps({
"description": "A dashboard to help auditors identify sample of issues to check.",
"editPermissions": [],
"name": name,
"sharePermissions": [
{
"type": "global"
}
]
})
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)
print(response.json())
然后我调用这个函数,但是失败了。
auth = auth("username", "password")
copy_dashboard(auth, 12221, "test_copy_dashboard") # it return 404
它返回 404:
{'message': 'null for uri: https://jira.xxx.com/rest/api/2/dashboard/12221/copy', 'status-code': 404}
我不知道我的代码本身是否有错误?
我不知道我的代码本身是否有错误? 或我没有找到的任何其他错误...