jira 更新时收到 204 响应
Receiving 204 respond while jira updating
我不明白为什么我想在 Jira 实例上更新一个字段时收到 204 响应?你能帮帮我吗?
import requests
server = 'https://myjira.com'
endpoint = '/rest/api/2/issue/'
auth = ('login', 'password')
headers = {
"Content-Type": "application/json;charset=UTF-8"
}
payload = {
"update": {"customfield_15950": [{"set": "1999-03-07"}]}
}
respond = requests.put(
f'{server}{endpoint}KEY-705',
headers=headers,
json=payload,
auth=auth,
)
print(respond, respond.text)
看来 204 是此处的正确响应。
见https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204
the HTTP 204 No Content success status response code indicates that the request has succeeded, but that the client doesn't need to go away from its current page. A 204 response is cacheable by default. An ETag header is included in such a response. The common use case is to return 204 as a result of a PUT request, updating a resource, without changing the current content of the page displayed to the user**. If the resource is created, 201 Created is returned instead. If the page should be changed to the newly updated page, the 200 should be used instead.
我不明白为什么我想在 Jira 实例上更新一个字段时收到 204 响应?你能帮帮我吗?
import requests
server = 'https://myjira.com'
endpoint = '/rest/api/2/issue/'
auth = ('login', 'password')
headers = {
"Content-Type": "application/json;charset=UTF-8"
}
payload = {
"update": {"customfield_15950": [{"set": "1999-03-07"}]}
}
respond = requests.put(
f'{server}{endpoint}KEY-705',
headers=headers,
json=payload,
auth=auth,
)
print(respond, respond.text)
看来 204 是此处的正确响应。
见https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204
the HTTP 204 No Content success status response code indicates that the request has succeeded, but that the client doesn't need to go away from its current page. A 204 response is cacheable by default. An ETag header is included in such a response. The common use case is to return 204 as a result of a PUT request, updating a resource, without changing the current content of the page displayed to the user**. If the resource is created, 201 Created is returned instead. If the page should be changed to the newly updated page, the 200 should be used instead.