Skip to main content

Postman

Postman is a great way to visually explore and interact with Metronome's API without writing code. There are two ways to get started with the Metronome API in Postman.

Prerequisites

Before you start, you will need the following prerequisites.

Getting started

  1. The Metronome OpenAPI spec can be imported directly into Postman and is always fully up to date.

    • To import the OpenAPI spec go to File > Import in Postman. Select Link from the top menu, and use Metronome's OpenAPI spec link. On the next pane, select Show advanced settings and make sure the Folder organization is set as Tags.

    Postman OpenAPI import screenshot

  2. The Metronome public collection can be accessed via

    Run in Postman

Configuring the Metronome collection

A Postman Collection groups request together in a folder structure, allowing them to be easily organized. You can fork the collection if needed. Forking provides for version control and facilitates collaboration.

Create a Metronome API token

You will need a Metronome API token to set up authorization for the collection. In Metronome, go to the API tokens section and create a new token. Be sure to save the token you create. You won't be able to view the full token again.

Postman OpenAPI import

Setup authorization for the Metronome collection

The Metronome API uses a Bearer Token. To set Auth up in the collection, click on your collection's top-level Metronome folder and select Bearer Token.

Set Auth to bearer token

For the token value, we will use a variable. To do this, enter {{api_token}} in the box below the Type dropdown. A window will appear saying unresolved variable. In that box, click on Add new variable, add your Metronome API token as the value, and set the scope to Collection: Metronome. Note that you can also add the variable manually in the Variables tab (Postman docs on variables).

Create variable in Postman for API token

Try it out

We will create a new customer using the Create customer request to test out the collection. To use this request, we need to ensure that the Create customer request is set to use the bearer token variable {{api_token}}. Navigate to the POST Create customer entry under the Customers folder, select Authorization, and select Bearer Token from the Type dropdown. Since we scoped {{api_token}} for the entire collection, the Token value should automatically be set to {{api_token}}. If not, just enter {{api_token}} in the Token box. Make sure you save your changes to the Create customer request.

Set auth for create customer request

Now that auth is set, we can create a new customer using the below JSON as the body of the request. Navigate to the POST Create customer entry under the Customers folder, select Body from the request options in the panel, then enter the following:

{
"name": "Example-Customer"
}

The response will look like

{
"data": {
"id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
"external_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
"name": "Example-Customer"
}
}

Now that the collection is set up, you can continue with the Metronome API.