Response Templating


More often than not, API simulations require HTTP responses to change between requests for the same simlet. Response templating is the solution for building dynamic HTTP responses.

Simula Template Engine


Simula is the API Simulator’s text template engine.

The template engine takes a template and combines it with data to produce the HTTP response.

A template consists of fragments. Some fragments don’t change and others can produce variable content.

Placeholders are a type of fragments that can produce variable content. A placeholder gets resolved to an actual value as part of rendering the template. By default, ${ and } enclose placeholders.

Another kind of fragments that can produce variable content is the scripting fragments, or scriptlets. Scriptlets are code. The template engine executes the code upon rendering the template, which may produce output. By default, scriptlets are delimited by <% and %>.

Here is how to define that a response is rendered from a Simula template:

  from: template
  template: Simula

The same configuration elements described in Response Stubbing can be configured with a Simula template:

  • Response Status

  • HTTP Protocol Version

  • Header Fields

  • Body, with

    • Text Body Content, or

    • Binary Body Content, with

      • Base64-Encoded Body Content, or

      • Binary Body Content From a File

It is just that they can be dynamic, as needed.

The next pages will cover the various aspects of configuring a template.

We would love to hear your feedback! Shoot us an email to [feedback at] about anything that is on your mind.

Happy API Simulating!