Make a API Call with Python


How can I make a proper API Call with python ?
I get a open session s with so I can make API call with my acount and s.get(URL, [data]) or, data).

All Get requests are working fine but Post are not working because I don’t understand how it is build. Swagger doesn’t provide any clue of what parameters are needed or not. And there is not good documentation with many examples.
Even the official doc ( doesn’t help. I want to build a AddQueueItem :

According to Swagger and Doc here’s parameters format :

	"itemData": {
		"Priority": "High",
		"DeferDate": "2018-03-21T13:42:27.654Z",
		"DueDate": "2018-03-25T13:42:27.654Z",
		"Name": "DocQueue",
		"SpecificContent": {
			"Email@odata.type": "#String",
			"Email": "", 
			"Name@odata.type": "#String",
			"Name": "O'Brian"

Here’s mine

	"itemData": {
		 "Priority": "High",
                 "DeferDate": "2020-04-08T06:52:37.648Z",
                 "DueDate": "2020-04-08T06:52:37.648Z",
                 "Name": "PowerShell_Queue",
                 "SpecificContent": {
			"Test@odata.type" : "#String",
  			"Test" : "test"}

All I get is this message :
{"message":"Une erreur sʹest produite.","errorCode":0,"resourceIds":null}

I can’t figure how we could make a post api call.

Both the docs and swagger show you sample calls (headers, body json payload, etc). It would be helpful to the community if you were to provide enough of your python script to show how you are building the requests and posting them.

This is how I use and call uipath api.

I can’t access pastebin from the network I am currently on, but viewed the code on my phone. Can you confirm (and it’s not just my eyes on a small screen) that you are not setting a Content-Type:application/json in your headers?

If you are sending the wrong Content-Type, Orchestrator will produce a generic error like you have described.

    "message": "An error has occurred.",
    "errorCode": 0,
    "resourceIds": null

I would recommend debugging with a higher verbose of the request and response that is being transmitted, or as an alternative test your requests with something like Postman or SoapUI.


To Add QueueItems you can refer to the below Orchestrator API - Add queue itemvideo link:

Hello Maxime,
In this video you see how I call Robot from Python all the code is in the description:

Cristian Negulescu

1 Like