An API Simulation consists of one or more simlets.


A simlet simulates the HTTP response to an HTTP request.

The expressive Java DSL (Domain Specific Language) of the Embedded API Simulator allows us to define simlets using Behavior-Driven Development (BDD) constructs. Let’s look at the following example:

         .whereQueryParameter("fmt", isEqualTo("json"))
         .withHeader(CONTENT_TYPE, "application/json; charset=UTF-8")
            "{\n" +
            "   \"results\" : [\n" +
            "      {\n" +
            "         \"name\" : \"Coo-coo Restaurant\",\n" +
            "         \"place_id\" : \"zE2toxSo\",\n" +
            "         \"rating\" : 4.2\n" +
            "      },\n" +
            "   ],\n" +
            "   \"status\" : \"OK\"\n" +

What the simlet does should be obvious just by reading the code but let’s read it aloud:

[Given] API Simulation apiSimulation, add simlet [named] "get-place-formatted-as-json" [such that]

When HTTP Request method is GET

And URI path is equal to "/api/places/place/zE2toxSo"

And Query String Parameter "fmt" is equal to "json"

Then [reply with] HTTP Response with Status OK (200)

And with Header CONTENT_TYPE ("Content-Type") with value "application/json; charset=UTF-8"

And with Body "{…​.}"

We would love to hear your feedback! Shoot us a quick email to [feedback at] to let us know what you think.

Happy API Simulating!