Covalent API Postman Collection

Quick Start

If you are already familiar with Postman, fork the Covalent API collection with: Run in Postman

 

What is Postman?

Postman is a free tool used by developers to quickly and easily send REST, SOAP, and GraphQL requests and test APIs. It is available as both an online tool and an application for Linux, MacOS and Windows. Postman allows you to quickly issue API calls and see the responses in a nicely formatted, searchable form.

We have made a Covalent API Postman collection that allows you to:

  • Quickly issue any Covalent API requests from Postman
  • Reference properly formatted requests and not worry about parameters and configuration
  • Focus on the API response and the data you need
  • Not have to copy and paste tedious values in long query strings!

 

Setup

Postman Installation

Postman can be installed locally or used as a web app. You can download Postman from https://www.postman.com/downloads/. It is recommended that you sign up using your email address as your workspace can then be easily backed up and shared between the web app and the app installed on your computer.

download_postman.png

After you have installed the application, run it. This will prompt you to create an account or log in.

 

Covalent API Collection Import

Next, here is how to import the Covalent API collection:

  1. On the Postman home page, you will see the section on Get started with Postman. Click on Create New.

getting_started

  1. Click on the Workspace option.

new_workspace

  1. On the new workspace page, click Import.

import_collection

  1. Click on the Link tab on the Import page.

import_link

  1. Paste the following Covalent API collection link into the URL field and click Continue: https://www.postman.com/collections/58c2cef37b968b9b4664

covalent_link

And now you have the Covalent API collection in your workspace!

  covalent_api_collection

Next we need to configure the collection to use the Covalent API key when making requests.

 

Covalent API Key Setup

To make a request, you will have to supply a Covalent API Key to Postman using the Basic Auth field.

  1. Go to https://www.covalenthq.com/platform to register and get your Covalent API key.

api_key

  1. Back in Postman, click on the top-level Covalent API (Public) menu item which will open up a config panel.

covalent_config_panel

  1. Under the Auth tab, select Basic Auth for the Type.

basic_auth

  1. Paste your Covalent API Key into the Username field.

basic_auth_username

  1. And be sure to click Save.

save_collection

Congratulations, you are now set up to try out all the Covalent API endpoints.

 

Making API Requests

The following steps outline how to use the Covalent API collection. By default, all requests within the Covalent API collection have pre-configured query values attached to the variables so you can just run and test the endpoints.

Fetching Token Balances

  1. Click on Get Token Balances for Address under the Balances/ folder on the left, and click Send.

sending_requests

  1. Review the API response in the bottom panel:

api_response

 

Changing Query Parameters

You may have noticed that in the GET URL field, there are highlighted variables such as {{chain_id}} and {{wallet_address}} . These are environment variables that you can configure with Postman. It is recommended that you change these environment variables instead of hardcoding values to reuse variables across all the endpoints in the collection.

  1. Click on the top-level Covalent API (Public) menu item again to open up the config panel.

covalent_config_panel

  1. This time, click on the Variables tab.

variables

This will open up a panel containing all the pre-configured variables within this collection and referenced in the query strings.

  1. To change the wallet address, for example, paste the new wallet address into the Initial Value and Current Value fields and select Persist All. Then, click Save.

persisting_all

  1. Now send the request again! You will see the response return the balances of the new wallet address you supplied.

sending_requests

You can change the {{chain_id}} variable as well if you want to check out address balances on other chain. Here is a snapshot of supported chains along with their chain IDs.

chain_id

Last modified: October 27, 2022: october-changelog-2022 (#243) (b6121bb)