REST API Trouble

I have a project where I am trying to interact with a REST API, but I’m not well versed at all with how REST works in or out of UiPath Studio. I have downloaded the UiPath.WebAPI.Activities and am trying to make a call following the API documentation at this link:

It’s not clear to me at all where in the activity definition I’m supposed to put the information requested to build the request body as defined in the documentation. I have my own UserName, Password, and AppKey, but I’m at a loss as to how to communicate them to get a session token returned to me.

I would be most grateful for a screenshot of a solution. Thank you in advance!

Hi @kevinpscott
Request body should be passed in Body section as highlighed below

Now you can store the request body in a notepad and then reading the same notepad (text file) using Read Text File Activity and storing the result in string variable and pass that string variable in that body section.

Nived N

Thank you for the quick response. I’m trying that, but having trouble with syntax:

Should I create an array and pass it in? Should I load the body into string variable and pass it in?

I loaded it into a string variable and passed it in.

I received the same error as I have all along:

{“HttpStatus”:400,“ErrorMessage”:“The request content-type is not supported”,“ErrorCode”:4005}

Feels like I’m missing something fundamental.

I did notice this:


So I changed this from application/xml to application/json but that hasn’t seemed to improve the result.

Hi Kevin,

Have you tried wrapping the contents of json body in single quotes instead of using double double-quotes

Also the change you made from application/xml to application/json is correct

Tried and failed. Still having the same error message:

{“HttpStatus”:400,“ErrorMessage”:“The request content-type is not supported”,“ErrorCode”:4005}

This seems strange because the content type is exactly what the API is requesting.

Even if I leave the body blank, I get the same error message.

I have accounted for target (in the EndPoint field), transport (in the Method field), and contentType (in the BodyFormat field) from the service info:

But not for uriTemplate or envelope.


I would say it is just matter of incorrect characters.

Take request body, pastes it into note, use ctrl + H (replace) and replace double quote (") to single quote-apostrophe (ascii decimal code is 39) an paste it into expression editor.

Forum interface is changing character to closing/opening single quotation mark

Hope this helps.

Great suggestion! I tried it and it didn’t seem to make any difference, still the same error message as before.

{“HttpStatus”:400,“ErrorMessage”:“The request content-type is not supported”,“ErrorCode”:4005}

As I said before, it feels like there’s something more fundamental that isn’t working here.

Perhaps one of you experts could build an activity that connects to it and share the .xaml?

Hi Kevin,

I think you have to provide following header in your request.
Content-Type: application/json

And below is the body string:
"{ 'Password ': 'openthedoor ', 'AppVersion ': '1 ', 'AppComments ': ’ ', 'UserName ': 'DM123456 ', 'AppKey ': 'ABC '} "

I tried it with this and the error I got was “{"AdditionalInfo":null,"StatusCode":0,"HttpStatus":401,"ErrorMessage":"Sorry, your login has failed|This is because your login credentials do not match our records.","ErrorCode":4010}”

I know it ended in error, but i dont have the valid creds so it was expected. Atleast it failed with different error right? :sweat_smile:

I have attached the workflow too for your reference. (2.5 KB)
Please try it with by replacing your creds.

SUCCESS! There were some extra spaces in the string you provided but once I removed those, it worked!

Thank you so much for your help!

Just for my knowledge, I deleted the Content-Type header and it worked as well, so that wasn’t a factor.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.