How to extract the cookies from the HTTP Request activity response in UiPath Studio?

I am currently working on an automation project with RPA and I am stuck in the use of the http Request activity. I need to send an http Request to the authentication service and obtain the authentication token contained in the response cookies. I tried several methods found on the forum but I can’t get my cookies.

When using Postman I can get them as below:

I have referred to Get cookies from httpRequest response already but found the thread as incomplete, hence raising another thread here. My problem is quite similar, in the response Header, I do not find the values of the cookies. So, is there any other way to retrieve all the cookies values? Please help. Thanks in advance

At this time, you cannot get the Cookies in your response.

You can only specify the cookies in the Options section when you are performing the request.

More details about HTTP Request activity can be found here: https://docs.uipath.com/activities/docs/http-client

But also, you may take a look here: API POST request giving 0 as status code - #11 by clibbytex

1 Like

Since its an API you could write a custom activity for it pretty quickly to overcome it with the ability to manage exceptions at the same time.

-Kane

Can you explain in more details please. Thanks

I have found a way to integrate and achieve this.

The arguments are as below

Now it throws error:

" at UiPathCodeRunner_a2e70fc513084a62ab400edfedc3037e.Run(String endPoint, String strReferer, String strType, String strEncPwd, String strUser, String strPwd, String stradmsID, String& cookies, String& exc)"

If I enable the client.CookieContainer = New System.Net.CookieContainer then it throws error:

@“Value cannot be null.
Parameter name: uri”

The same code is running fine in Visual Studio 2019.

Where am I making the mistake? Can anyone guide please.