How to get curl -b cookies.txt value in APIGEE flow

yugantus
Participant I

Hi,

I am trying to get the value of cookie.txt data in apigee flow logs, but it is not shown in any flow variable. Can anyone help me on this.

This is the below request we are sending to apigee endpoint with -c ~/cookies.txt -b ~/cookies.txt

curl -s -X POST -k --data @- https://xxxxxxx/resources/json/delphix/login -c ~/cookies.txt -b ~/cookies.txt -H "Content-Type: application/json"

0 2 358
2 REPLIES 2

In Apigee, you can find cookies in the Cookie headers. Use the context variables for request headers.

Also: It sounds to me that you are using Apigee not for APIs but for some other purpose. that;s probably a bad idea. APIs don't rely on cookies.

Hi Dino,

Thanks for the reply!

Below I am sending the sample API call which I sent through Postman. I want to get this cookie data in all api subsequent call, but the issue I am getting is that I am not able to get the cookie value in

var req_Cookie = context.getVariable('request.header.Cookie');
    var req_Cookie1 = context.getVariable('request.header.cookie');
    print("req_header_Cookie "+req_Cookie);
    print("req_header_Cookie1 "+req_Cookie1); 
// Trace Output from all Transactions

req_header_Cookie null
req_header_Cookie1 null

I am getting these headers [Accept, accept-encoding, cache-control, Content-Length, Content-Type, cs-appId, cs-email, cs-pid, Host, Postman-Token, User-Agent, x-apikey, X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto] in request header but not getting the cookie header.

9501-samplecall.png

As you see in the response we are not able to get any value in context.getVariable()

Regards,

Yugant