maro584
maro584

Reputation: 11

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

Upvotes: 0

Views: 507

Answers (1)

maro584
maro584

Reputation: 11

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" )

Upvotes: 0

Related Questions