Beeceptor's template engine just got more powerful! Now you can use advanced operators and helpers to create dynamic, realistic mock responses with ease.
Examples:
{{modulo 7 3}}
1
{{round 3.7}}
4
{{toFixed (body 'amount') 2}}
{{split "1;2;3;4" ";"}}
1,2,3,4
{{base64 "hello world"}}
aGVsbG8gd29ybGQ=
{{{someOf (array 'car' 'house' 'boat' 'bike' 'land')}}}
["bike","land"]
Build smarter mocks faster—check out the docs! 🚀
Read the whole post
Beeceptor now supports stateful mock APIs with three powerful persistence helpers, allowing you to maintain context across requests for more realistic API testing.
Store and retrieve values across mock requests, making it easy to persist user details, order IDs, or session data. For example:
{{data-store
Invite your network and earn rewards: For every 10 signups through your referral link, you’ll get a 30-day Team Plan (worth $25) free. Plus, when someone you refer upgrades to a paid plan:
Invite. Earn. Repeat. Start sharing your referral link today and grow the hive! Learn more here and get started today!
Beeceptor now supports enhanced array manipulation with the #each helper in its dynamic template engine. You can iterate over arrays in incoming requests, apply transformations, and generate responses that adapt to varying array lengths and structures.
#each
Syntax:
[ {{#each (body 'listOfItems')}} { "rank": {{@index}}, "title": "{{this.name}}", "details": "{{this.description}}", "id": "{{faker 'string.uuid'}}" }{{#unless @last}},{{/unless}} {{/each}} ]
Key highlights:
@first
@index
@last
#unless
Learn more with examples in the documentation.
We’ve made building powerful mock APIs even better by adding date and time formatting! Now you can easily confirm data recency with just a few template tweaks. Check out these handy examples:
{{now 'utc'}}
2024-10-13T16:29:58Z
{{now 'x'}}
1730177984595
You can also generate relative times with extra parameters:
{{now '{hours:3}' 'utc'}}
{{now '{months:-11, days:-1}' 'iso'}}
Learn more about these updates here.