Dynamic Values & Custom Functions That Save Your Time

LazyasscoderLazyasscoder
3 min read

If you’re testing APIs daily, you know the pain: copying IDs across requests, manually generating timestamps, writing throwaway scripts just to get through a checkout flow.

That’s exactly where EchoAPI’s dynamic values + custom functions shine. They let you skip repetitive work and focus on business logic, whether you’re debugging a fintech API or stress-testing your e-commerce stack.

Here’s how it works in real-world setups 👇


1. Dynamic Values: Stop Copy-Pasting, Start Automating

Dynamic values are auto-generated or real-time values (timestamps, random strings, or variables pulled from a previous response). They solve two annoying problems:

  1. Params that always change (like timestamp, nonce).

  2. Chained APIs where one request depends on the output of the last.

1.png

Example: E-commerce Checkout Flow

Imagine you’re debugging: Create Order → Make Payment

  1. Create Order API gives you a fresh orderId each time. Instead of copying it by hand:

    • Add a mock data function

      2.png

    • Insert → send → get random test output

      4.png

    • Extract orderId into your environment vars — no copy/paste

      6.png

  2. Payment API then needs:

    • That same orderId

    • A timestamp (to dodge expired requests)

    • A nonce (to block replay attacks)

7.png


Why It’s a Game Changer

  • Zero typos: Stop breaking requests because of one bad copy.

  • Faster debugging: A flow that used to take 5 mins → <1 min.

  • Global ready: Timezones handled automatically (UTC, JST, PST, WIB, etc).


2. Built-In Dynamic Values: Ready to Use

No setup, no scripts. EchoAPI ships with pre-baked dynamic values you can drop right into your requests.

Time Values (Most Used)

Great for APIs that validate timestamps, expire tokens, or just need “current time” in the right format.

image.png

👉 No timezone math. Ever.

Random Values (Perfect for Testing)

Need throwaway test data? Generate it on the fly:

image.png

Environment + Constants

Grab env info (project ID, environment, IP, EchoAPI version) or drop in constants (null, {}, [], "") to cleanly test API behavior.

image.png


3. Custom Functions: When You Need Business Logic

Sometimes built-in tools aren’t enough. You need to encrypt, reformat, or apply custom validation. That’s where Custom Functions come in — write a quick script, run it inline, and reuse it across requests.

Example: Fintech Parameter Encryption

Say your Bind Card API requires:

  1. Encrypting phone with MD5.

  2. Prefixing the result with IDN_FIN_.

Instead of juggling external tools, just drop in a JS function inside EchoAPI.

11.png

No need for a local crypto setup — test, debug, and ship all in one place.


Why It Matters

  • Custom business rules: Prefixes, non-standard algos, whatever your API demands.

  • Fewer dependencies: No extra tools or environments.

  • Region-ready: Easy to adapt for US, JP, ID, etc.


4. Built-In Functions: The Everyday Toolkit

EchoAPI also gives you system functions so you don’t even have to write code for the basics.

  • String ops: strToUpper, strTrim, strReplace

  • Data conversion: toNumber, parseJson, formatDate

  • Crypto/encoding: md5, sha256, base64Encode

  • Math/logic: mathAdd, ifElse, isEmpty

  • System utils: getEnv, setEnv, uuid, timestamp

Example: Generate a signed param:

const timestamp = new Date().getTime();
return `${text}-${timestamp}`;

20.png


Why This Matters

image.png

With EchoAPI, you can skip the boring stuff, reduce human error, and move faster. Whether you’re hacking on a side project or scaling across regions, dynamic values and custom functions keep you shipping — not babysitting params.

0
Subscribe to my newsletter

Read articles from Lazyasscoder directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Lazyasscoder
Lazyasscoder