[英]Post request ServiceDesk+ API
I am trying to request some endpoint using POST method, unforunatelly for POST I can not receive any usefull informations. 我正在尝试使用POST方法请求某些终结点,这对于POST来说是非常困难的,我无法收到任何有用的信息。 When I am trying to make GET method request there is no problem, but only with POST method
当我尝试发出GET方法请求时,没有问题,而仅使用POST方法
data = {
"operation": {
"details": {
"from": "10",
"limit": "11",
"filterby": "All_Requests"
}
}
}
r = requests.post("http://<ipaddress>/sdpapi/request?OPERATION_NAME=GET_REQUESTS&TECHNICIAN_KEY=<API_KEY>&input_data=" + str(data) + "&format=json" )
r.status_code
print(r.status_code)
print(r.text)
This is what I am receiving executing above code: 这是我收到的执行上面的代码的结果:
200
{"operation":{"result":{"message":"No input data for get all requests","status":"Failed"}}}
I have tried to change a location of "OPERATION_NAME=GET_REQUESTS" in URL unfortunatelly it did not help 我试图在URL中更改“ OPERATION_NAME = GET_REQUESTS”的位置,但是这样做没有帮助
I have found a solution, I have change an order of other URL parameters :) . 我找到了解决方案,我更改了其他URL参数的顺序:)。
r = requests.post("http:///sdpapi/request?INPUT_DATA=" + str(data) + "&OPERATION_NAME=GET_REQUESTS&TECHNICIAN_KEY=<>API KEY&format=json" ) r = request.post(“ http:/// sdpapi / request?INPUT_DATA =” + str(data)+“&OPERATION_NAME = GET_REQUESTS&TECHNICIAN_KEY = <> API KEY&format = json”)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.