Search code examples
randommockingpostmanresponse

Postman mock servers - Mock a response with a random 10-digit number


I’m using Postman 8.12.1. I’m creating a mock server and trying to set up my mock response for a certain request so that the response returns a random 10 digit number. However, the only pre-built function I can find is “randomInt”

enter image description here

That seems to have a very limited range. Is there a way I can configure my response to return a random integer that has 10 digits? It is fine if the leading digits are zeroes.


Solution

  • You can use $timestamp which will return 10 digits number:

    The current UNIX timestamp in seconds (as 1562757107)

    You have similar options as $randomBankAccount

    A random 8-digit bank account number

    Or $randomPhoneNumber

    A random 10-digit phone number (as 700-008-5275)