The distro for the Standalone API Simulator™ contains few examples. Here is how to run them locally.
For simplicity, we will assume that the installation of API Simulator is under the root directory. Adjust the directory paths accordingly if the installation is in a different directory.
We recommend adding the API Simulator scripts to the command path. While you don’t have to do this, it will make running the examples a bit easier.
Start an API Simulator instance by executing the apisimulator script passing in the start argument, and fully qualified path to the simulation’s directory or path relative to the current directory:
apisimulator start examples/<simulation-name>
On Linux, the command starts API Simulator in the foreground (append
& to the command to background the process). On Windows, the command starts API Simulator in a new Command Prompt window.
API Simulator listens for requests on its default port
6090. The API Simulator’s Admin Server, which allows for clean shutdown of the simulator, runs on its default port
To stop API Simulator when done running an example simulation, execute:
apisimulator stop examples/<simulation-name>
One way to run the examples is via
cURL - a well-known command line tool for "…transferring data with URL syntax" over various protocols (see https://curl.haxx.se/). It is included in many Linux distributions. You can download the latest version here, including for Windows. Please see the
cURL documentation for a description of the command line arguments.
Another way to run the examples is by using the simple API Client tool distributed with API Simulator. The
README.txt file in the directory of some of the examples contains more information.
Notice that double quotes surrounding API Simulator script arguments are required if directory paths or file names contain any spaces.
Double quotes inside
curl command line arguments are escaped like this:
We would love to hear your feedback - send us a quick email to [feedback at APISimulator.com]
Happy API Simulating!