API Simulator 0.5.0 Release

January 29, 2017

 

API Simulator v0.5.0 Release Changes

  • Enhanced and more precise request URI matching.
  • Modified existing examples to use the new enhanced URI matching.
  • Decoding the URI parts (e.g. ‘+’ to space, %HEX to actual UTF-8 character, etc.) now happens at the time of parsing the input instead of during parameter matching.
  • Added out-of-the-box support for JSON, XML, and URL encoding of placeholder values.
  • Defect fixes and internal refactorings.

Below are a few details about the changes in this release.

 

Request URI matching was flexible before. For example, it supported URI path pattern matching.

Matching a request URI is now even more powerful with support for fine-grained matching of any URI parts – scheme, user info, host, port, path, query string, and fragment. What is even more is that there is support for multi-value query string parameters, too!

Here is an example that explains some of the enhancements in URI matching.

Assume the request URI is this:

/api/places/json?location=34.7223607,-102.2841964&types=food&radius=5

Before, if we were to attempt a match using a rule with this meaning:

URI contains "radius=5"

we would have matched URIs like this one, too:

/api/places/json?location=34.7223607,-102.2841964&types=food&radius=50

which may not be desired.

Now with the enhanced URI matching we get to specify matching rule with this meaning:

 URI query parameter named "radius" equals "5"

 

Here is another example. Let’s look at these HTTP request URIs:

(1) /api/places/json?location=34.7223607,-102.2841964&types=cafe&radius=5
(2) /api/places/json?location=34.7223607,-102.2841964&types=food&radius=5
(3) /api/places/json?location=34.7223607,-102.2841964&types=cafe&types=food&radius=5
(4) /api/places/json?location=34.7223607,-102.2841964&types=food&radius=5&types=cafe

Expressing a matching rule like this:

 URI query parameter named "types" equals "food"

will match URIs (2), (3), and (4).

Expressing a matching rule like this:

URI query parameter named "types" equals "cafe"

will match URIs (1), (3), and (4).

To match URI (3) or (4) only, we can express the rule as:

 URI query parameter named "types" equals "food" and "types" equals "cafe"

 

As a side node – perhaps one day we would have a DSL to express the matching rules in a more friendly form as above 😉


We invite you to learn more about API Simulator, download and install it, and run the examples. Why not even create API simulations to help your own testing and development?

Let us know what you think at [feedback at APISimulator.com]. Many thanks for your interest and support!

 

Happy Simulations,
The API Simulator Team