SHARE THIS ARTICLE

Using the API Console

Our API Portal generator will create an API console like the one below for every endpoint in the API. The API console shows how to call the endpoint using the SDK. This helps the API consumer to get started quickly with using the API.

API console in action

Some of the features include:

  • Auto-generated usage example for the endpoint
  • Calling the API from the console
  • Change arguments before calling the API (including auth info)
  • Code samples are reactive: they change with user input
  • API response body and headers will be shown after API call
  • Create a sample app with complete code for initializing the SDK and calling the API (see the sample below)

Full code sample

The API console is created from your API description: hence, it will only be as correct as your API description.

Let’s break down what the console contains:

Parameters

If the endpoint has parameters, APIMatic will create fields here. We support complex types as well. The fields will be prefilled with examples from the API description if available; otherwise, the fields will default to dummy data.

Show Config

This reveals the configuration form.

  • The Show Complete File options enables the user to see a more detailed code sample when selected which include namespace imports, error handling and authentication configuration. This is normally hidden to show a concise, readable sample code.

  • If your API has multiple environments defined, then an Environment dropdown will be shown.

  • Depending on the authentication selected, additional input fields may be shown. The values provided will be used to update the code sample and for making API calls.

Code Sample

We created the Reactive Code Samples to show the user what the calling code would look like for a particular input. This lets user specify endpoint arguments in a language-agnostic way but get a language-specific code sample in return.

Run button

This lets the user call your API using the arguments provided. The API calls are made using a proxy to avoid CORS related issues in the browser. The response is parsed and shown in the console.

  • JSON response will be shown using a JSON tree viewer.
  • Other response types will be shown as a raw text body.
  • Response headers are also shown in a separate table.

Have questions? Submit a request.