Watch API Traffic with a Proxy

Now we're going to show you how to automatically generate an OpenAPI 3 specification on the client side, using a proxy. You can then use the API for documentation, diffs, and more.

Before we get started

You'll need the following things in order to follow along with this tutorial:

  • Akita Client - If you don't already have the Akita Client installed, follow this guide to get set up.
  • API Service - You will need a service that provides an HTTP API that you can access either through a browser or a proxy (for instance, Charles).

Getting Started

Now we'll show you how to use Akita to:

Create a Service

To build API models from traffic, you first need to create a ‘Service’ to associate the model with.

You can name your new service whatever you like, but it will be easier to find it again later if the name reflects the name of the API whose model you're learning.

Automatically Learn an OpenAPI Model

The next step collect API traffic using a proxy. We have instructions using both mitmdump and

Step 1: Follow the instructions for using Akita with a proxy to generate a HAR file.

Step 2: Generating an API Model

You can use the apispec command to transform a trace (the HAR file) into an API model.

akita apispec --traces path/to/yourTraceFile.har \
  --out akita://myService:spec:mySpec

This will read the HAR file from your file system (use the location where you saved the HAR file instead of path/to/yourTraceFile.har) and create a model in the Akita Cloud. Use your service name instead of myService in the AkitaURI, and pick a name for the model.


Did this page help you?