Loosing current values API Keys stored in environment variable in Postman - postman

I have stored my API keys as environment variables in Postman. After logging into my API, a script reads fields and sets current values using pm.environment.set('api-key-token', data.api_key).
The issue/inconvenience I am having is every time I change a Query param, I lose my API key current value. I thought the current values are only lost when you log out of your postman. Is this behavior normal?

Related

Path based AWS API Caching Keys Issue

I have several API paths set up in a test API Gateway setup with a simple 'api' stage. I am using AWS Lambda and wish to cache the results of the lambda call.
There are three test paths (no authentication)
/a/{thing} (GET Caching turned on in stage)
/b/{thing} (GET Caching turned off in stage)
/c/{thing} (GET Caching turned off in stage)
They all map to the same lambda function. The lambda function returns the current time and the value of {thing}.
If I request /a/0000 through /a/1000 I get back the same result for a function that ran for thing=0000.
If I request /b/0000 through /b/1000 (or /c/) I get back uncached results.
thing is selected as 'cache' in resources /a/{thing}. Nothing else is set 'cache'.
It is my understanding that selecting 'cache' next to a path element, query element, or header would construct a cache key - possibly a multi-key cache key hash. That would be ideal!
Ideally /a/0000 and /a/1234 would return a cached version keyed to the {thing} value.
What did I do wrong or misread or step over? Am I hitting a bug when it comes to AWS Lambda? Is caching keyed to authorization - these URLs are public and unauthenticated. I'm just using curl to request these and nothing is being cached on the client side of course.
Honestly. I've also tried using a query argument as the only cache key and let the cache flush and waited 30 minutes to try try try again. Still not giving the results I would expect.
Pro Tip:
You still have to deploy from resources to stage when you set up cache keys. This makes sense of course but it would be good if the management console showed more about the method parameters than it does.
I am using Chalice.. which is why I wasn't deploying in the normal fashion.

Lambda Returned Payload Different Than Received Payload

I have an AWS Lambda function that has been working as expected for months. It delivers a python dictionary using json.dumps
I added a new variable to the dictionary with a string 'true' or 'false' value. I store the dictionary into a variable, and log it one line before returning it using the same variable to the requester.
The logger shows the payload has 'variable_name': 'true' but when it gets delivered to the requested, it changes to 'false'.
What could cause the variable to change?
The problem was website server caching as part of a Wordpress plugin. Clearing the website cache fixed the problem.

How to store chat-conversation of chatbot(in aws lex) in DynamoDB

I am building a chatbot for a website that has lots of traffic
I decided to build chatbot in AWS lex
I want to save all chat conversation an single attribute in Dynamo DB for that I had chosen list data type for that attribute
and I am able to get all the slot data into different variables but how to save user entered utterance and prompts that we defined in lex console and how to arrange them like a conversation.
If is there any alternative for storing chat conversation?
Since it's your bot, you know the session timeout value. In your lambda function you can generate a session id (random UUID) and put that in session attribute (read more here). You can create a DDB table in your account and design it like this:
Hash Key: userId
Range Key: sessionId#timeStamp
Request (String attribute): JSON format of request structure that is sent to Lambda function
Now as long as the session is valid you can always retrieve the sessionId that you put in session attributes map. Using this you will always be able to create the range key (sessionId + "#" + currentTimeStamp). In every call that you get in your lambda you also get the user-id for your bot. You can all this information to store the utterances the way you might like.

Django session strange behavior

Currently using django 1.7.
I'm using a file based session storage and have request.session.modified set to True. In a simple DB record creation, i store the row id in the session like so:
request.session['rid'] = xyz
request.session.modified = True
I checked if the value is really in the session and it is. In another request (same session though), I tried to read the 'rid' value but the 'rid' does not reflect the newer value i just created instead it shows the older value.
The browser is kept open and record creation is a constant process.
I also checked the session_key and its the same in both cases. I'm not creating any new session vars apart from this value (or modifying it). I switched to file based session storage because DB session had the same issue.
I'm at loss as to how this is happening. Can somebody help?
TIA

How do I set the cache key for the AWS API Gateway?

I have a Lambda function that is mapped to a HTTP endpoint using the AWS API Gateway. This works fine, I have mapped query string params to the Lambda event, everything works:
https://api.buzzcloud.xyz/?count=999
Which I can call from http://buzzcloud.xyz
I would like to enable caching, but it seems that by default the API Gateway uses the URL for caching, and so changes in my query string parameters are not triggering a different cache result.
The result is that with caching on, my page returns whatever data was first requested and put in the cache.
How do I set a custom cache key or ensure querystring is part of the cache identifier?
Turns out the is a not-so-secret setting that I totally missed that allows for the exact query string params that should be used for the cache to be set.