简体   繁体   中英

Post request ServiceDesk+ API

I am trying to request some endpoint using POST method, unforunatelly for POST I can not receive any usefull informations. When I am trying to make GET method request there is no problem, but only with POST method

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

I have found a solution, I have change an order of other URL parameters :) .

r = requests.post("http:///sdpapi/request?INPUT_DATA=" + str(data) + "&OPERATION_NAME=GET_REQUESTS&TECHNICIAN_KEY=<>API KEY&format=json" )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM