Legacy Documentation
You're viewing legacy documentation for API Fortress (deployed via an on-premises container). To view documentation for the new SaaS version of API Fortress — now known as Sauce Labs API Testing and Monitoring (with Sauce Connect tunnels) — see API Testing on the Sauce Labs Cloud.

Mock Recording Part 1: Starting the Kong Proxy (Deprecated)

Note: The latest version of Kong is not supported by API Fortress. However, we have now released our own Microgateway that you can use to do mock recording as well as many other features! Click here to download AFtheM and learn more about the features here.


Mock recording allows an API Fortress user to pass API requests and responses directly into the API Fortress mocking platform. This largely eliminates the need to manually create mock response cases. To do so, we’re making use of the Kong Microgateway. The process is divided into a few parts. Here’s how we’re going to approach it:
  1. First, we’re going to turn on the Kong proxy server.
  2. Next, we’re going to create a proxied endpoint.
  3. Finally, we’re going to push that proxied endpoint into API Fortress mocking.
A few of these steps are fairly technical, but we’re going to be as explicit as possible with the documentation and as always, if you need assistance, feel free to reach out to support@apifortress.com.

What We Need:

Let’s make sure we have everything we need:
  1. An updated version of the API Fortress core/docker-compose.yml which includes the Kong section at the end. The bottom of your docker-compose should look like this:
    image: apifortress/kong
    hostname: kong.apifortress
      - kong.apifortress
    KONG_DATABASE: postgres
    KONG_PG_HOST: postgres.apifortress
    KONG_PG_USER: ********
    KONG_PG_PASSWORD: ********
    KONG_PLUGINS: fortress-http-log,file-log-extended,request-transformer,upstream-replace
    KONG_PROXY_ERROR_LOG: /dev/stdout
    - 8000:8000
    - 8001:8001
2. The initialization script, init_kong.sh 3. The start script, start_kong.sh
If we have all of the above, perfect! We’re ready to start. If not, feel free to reach out to support@apifortress.com to let us know what you need!

Starting Kong:

First, we need to ensure that at the API Fortress Postgres instance is running. Execute a
sudo docker ps
from the command line and ensure that it is running. The image below is the entry that you’re looking for: postgres_image Next, we need to initialize Kong. This is done by running the previously mentioned script, init_kong.sh. Issue the following command from the command line:
sudo ./init_kong.sh
Once Kong has finished initializing, we can proceed. Next, we need to start the Kong container itself. We do so by issuing the following command:
sudo docker-compose up -d apifortress-kong
Once the container has finished starting, we can do a
sudo docker ps
to view the currently running containers and verify that we started it successfully. verify image started Finally, we can verify that the proxy is up and running by issuing the following cURL command from the command line, or an identically structured HTTP request from the HTTP client of your choice (note: replace the ‘apif.example.com’ component with the corresponding part of your instances URL):
curl -v http://apif.example.com:8001
A positive response from this route indicates that the proxy server is up and running. Congratulations! You now have a live proxy server! Our last step in the setup phase is creating an API Fortress API key. The gif below shows the process. make_api_key
  1. Click the gear in the upper right corner of the view
  2. Click “API Keys” in the navigation bar on the left
  3. Click “+API Key”
  4. Name and save your API Key. It’s helpful at this point to copy the key and secret to an easy to reach location, as we’ll need it in later steps.
NEXT – Step 2: Proxying a Route