Hello,
New developer here, and new to OutSystems.
I need to make a POST request, and retrieve a token returned in a cookie from the response.
I clearly do not really understand how to use the GetCookie method in OutSystems.

Assume this is how I would like the action to flow:


Basically I'm not sure what to pass as the parameter for the cookie name. I know the name of the cookie whose value I want, but obviously passing in "<cookie name>" will not work.

Any help would be appreciated. I'm sure this is something simple, I'm just learning.

Thank you!

Solution

Hi Landon,

I believe GetCookie and SetCookie from the HTTPRequestHandler extension will only affect the client communicating with the screen and not other requests like arbitrary POSTS. I know HTTPRequestHandler lets you do POST requests as well, but I don't know if you can add headers onto the POST request you're building, which means there will be problems with most servers since they'll ask you to set a "Content-Length" header at the very minimum.

Have you checked out the Forge? I believe the ardoHTTP extension does everything you're looking for in a more convenient package, since you can define your headers and then recover the cookies from the output of the HTTPPost action. Cookies should appear as "Set-Cookie" headers in your response, and you can then process them.


Solution

Thank you!