HTTP Request - POST call gives blank item

I have tried to integrate UiPath’s HTTP Request and calling 2 of the ‘restdb.io’ APIs.

  1. The ‘GET’ request is working fine and returns a list of items from my collection in the database from 'restdb.io.
  2. However, when making a ‘POST’ call (To create an item in the table in restdb database), blank items are created even though the status of the API call is ‘201’.

When clicking on preview, this is the result:

and in restdb.io, here is the blank item:
image

Please help me in finding out, what I did wrong.
Via POSTMAN I am able to correctly create an item. So it has to lie in the UiPath activity.

@Thomas_Volker

From postman please copy the curl and use import in http request activity and try

May be you missed some parameters to be sent

cheers

Hi there @Anil_G ,

Here is the postman:
curl --location ‘https://devama-4701.restdb.io/rest/test
–header ‘Content-Type: application/json’
–header ‘x-apikey: 2ccce804d2ec06cd36fa67ee1a0592a5312f1’
–data ‘{“name”: “hi”}’

I have changed the ‘body’ in the UiPath properties to look like: “{”“name”“: ““hi””}” so that it’s a string.

However unfortunately the item in the restdb table still gets created blank as per above screenshot still.

@Thomas_Volker

But in the screenshot i see single quotes and not double.

Am I missing something?

Cheers

Apologies I have updated the single quotes to this as single quotes don’t work: “{”“name”“: ““hi””}”.

But this still doesn’t work.

I have managed to make the POST call work by first writing the body in a TXT file and then reading that txt file into a string and using that string variable in the HTTP Request activity. This works, however should not be the way we solve this.

This indicates that the way the ‘body’ is written is wrong OR UiPath’s activity library is not handling the body correctly?

@Thomas_Volker

Can you print the value read from text and the value you are writing and check if both are show as same

Cheers

Both outputs seem to be the same. So I am wondering what happens inside the ‘HTTP Request’ activity library how it consumes the body variable?

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

Hi @Thomas_Volker

Just to leave some extra info. You can always try with a site like http://webhook.site, by sending the same call from studio with a string variable and the simple text. This way you will see whether there is any difference in the call content (for whatever reason).