Scenario: The objective is to create, in UiPath Studio, a workflow that simulates a login to an api and from that login to obtain the response headers of a sign_in api.
The response headers to get are: Access-Token, Client and Uid.
So far I haven’t found a concrete answer for what I want, since the only headers I’m getting through an HTTP Response to the sign_in API are: Transfer_Encoding, Connection, X-Frame-Options, X-XSS-Protection, X-Content-Type-Options, X-Download-Options, X-Permitted-Cross-Domain, Refferrer-Policy, X-Request-Id, X-Runtime, Vary, Cache-Control, Content-Type, Date.
Here is an example of what I want to get using UiPath Studio:
Can you try the request in postman and check if you are getting this info
Yes, I’m getting all I want, here is a photo of it:
No headers added btw, I just put in the body the email and password to sign in
Have you tried using header from the property of Http Request:
Let me know if you need any help extracting details from the same.
You can try to get the Headers using the Headers property in HTTP Request Activity Output Section.
It will give you the data in a Dictionary type of format which you can use freely in the workflow.
Thank you for your answer!
I tried to use it but it doesn’t send back what Postman returns
Is it possible to share what do you get ?
Is it JSON ?
Thank you for answering me!
I have a few questions about this case because it’s no longer making any sense
First question is: In my HTTP Request, why can’t I put the email and password on the Body Section and have to turn them into parameters to stablish the connection?
Here is an example:
If I put the email and password as parameters then it returns 200 code and connects to the API but if I try to do the same I do in Postman (on the Body section) it doesn’t return anything but error like this:
This is the result if I put email and password on Body and I don’t reallt get it, why does this work on Postman and not here too?
Second question is: I tried to use Headers, Content and Attachment but it doesn’t return anything like I have on Postman (the picture in my first comment where I have Client, Access-Token and Uid Headers), why?
Here is an example of what it returns as Headers:
Basically the Content returns me the same thing when I see the preview of the Sign In with email and password as parameters!
Is it necessary to change the type of the variables?
Yes, it is returning JSON!
Please check the comments below, I did a few comments because as a new member I can only put one picture per comment
I haven’t worked extensively with the API Calls but back when I have used API calls, we too were passing the email and password through parameters.
May be that’s the way how this API is built, that it’ll take details from Parameters.
But for the Headers, you should definitely be getting something in return, can you try to loop through the items retrieved in Headers, can you check the count of items first, whether it has something or not.
This is a dictionary that is returned…
Can you check the keys of the dictionary…the rwquired key might be present…
You can use for loop and dict.keys and inside loop use dict(keys) to check the values
The thing is, if I put the email and password as parameters then they can’t change dynamically, or not?
I want this API to receive an email and password before it gives the headers and the login credentials will be in cycle (I have three credentials, for example, and they will be in recurrent loop).
I have this loop created and it just returns these headers: Transfer_Encoding, Connection, X-Frame-Options, X-XSS-Protection, X-Content-Type-Options, X-Download-Options, X-Permitted-Cross-Domain, Refferrer-Policy, X-Request-Id, X-Runtime, Vary, Cache-Control, Content-Type, Date.
As you can see in the main post, I want to receive the Access-Token, Client and Uid but for some reason I can’t get these headers and only some of them. The question is, why can I receive them on Postman and not in UiPath? I don’t know, it can be something little and we don’t know