0
0
Postmantesting~5 mins

Timestamp generation in Postman - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a timestamp in software testing?
A timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day.
Click to reveal answer
beginner
How can you generate a current timestamp in Postman?
You can generate a current timestamp in Postman using JavaScript code like var timestamp = Date.now(); which returns milliseconds since January 1, 1970.
Click to reveal answer
intermediate
Why use timestamps in API testing?
Timestamps help track when requests are sent or responses received, ensure data freshness, and avoid replay attacks by making each request unique.
Click to reveal answer
intermediate
What is the difference between Unix timestamp and ISO 8601 format?
Unix timestamp is a number representing seconds or milliseconds since 1970-01-01 UTC. ISO 8601 is a readable string format like 2024-06-01T12:00:00Z representing date and time.
Click to reveal answer
intermediate
How to use timestamps in Postman pre-request scripts?
In pre-request scripts, you can create a timestamp and save it as an environment variable to use in your request, for example:<br>pm.environment.set('currentTimestamp', Date.now());
Click to reveal answer
Which JavaScript method returns the current timestamp in milliseconds in Postman?
ADate.getTime()
BDate.now()
Cnew Date().timestamp()
DgetTimestamp()
Why is it useful to add a timestamp to API requests?
ATo make requests unique and prevent replay attacks
BTo slow down the server
CTo change the API endpoint
DTo encrypt the request
Which format is a Unix timestamp?
AA date written as 'June 1, 2024'
BA string like '2024-06-01T12:00:00Z'
CA number representing seconds or milliseconds since 1970-01-01 UTC
DA random string of letters
How do you store a timestamp in Postman environment variables?
Apm.response.set('timestamp', Date.now());
Bpm.variables.get('timestamp');
Cpm.request.timestamp = Date.now();
Dpm.environment.set('timestamp', Date.now());
What does Date.now() return?
AMilliseconds since January 1, 1970
BCurrent date as a string
CSeconds since January 1, 2000
DA formatted date object
Explain how to generate and use a timestamp in Postman pre-request scripts.
Think about JavaScript code and environment variables in Postman.
You got /3 concepts.
    Describe why timestamps are important in API testing and give an example.
    Consider security and data freshness.
    You got /4 concepts.