Coins: 17,423
Exchanges: 1,289
Market Cap: $3.454T 0.9%
24h Vol: $118.683B
Gas: 0.605 GWEI
Go Ad-free
API
TABLE OF CONTENTS

Postman Tutorial: How to Use Postman for API Testing (with Examples)

4.8
| by
Roxait
|
Edited by
Julia Ng
-

This guide aims to equip developers & quality assurance (QA) teams with the knowledge and tools needed to efficiently test APIs using Postman, a popular API development environment. Let’s unpack some of these terms before diving in.

What is Postman?

Postman is a popular API platform and development tool that allows users to design, test and document APIs efficiently. It provides a user-friendly interface for sending HTTP requests, receiving responses, automating tests and managing API endpoints, enabling developers to streamline API development and testing workflows.

What API testing?

API testing involves evaluating APIs to ensure they function correctly, perform under load, and are secure and reliable. During testing, requests are sent to the API endpoints, and responses are analyzed to ensure they meet expected outcomes.

In this guide, we’ll demonstrate how to use Postman to test various endpoints in CoinGecko API. Specifically, we’ll run through live examples covering these endpoints:

  1. Coin Price by Ids – /simple/price
  2. Top Gainers and Losers – /coins/top_gainers_losers **requires a Pro API key (paid subscribers only)
  3. Coins List with Market Data – /coins/markets
  4. Coin Data by ID – /coins/{id}

With that, let’s get started!

postman api testing tutorial

Prerequisites

To follow along, be sure to have the following installed and available: 

  • CoinGecko API: We will use the CoinGecko API to fetch market data for cryptocurrencies. The free Demo plan is sufficient in the context of ths guide, for most of the examples shown unless otherwise stated. Create a Demo account to get your complimentary API key, capped at 10,000 calls per month and a rate limit of 30 calls per minute.
  • Postman API Platform: Ensure the Postman app is installed on your device to continue with this guide.

Step 1: Open Postman & Create a New Collection to Store Requests

Open the Postman app and create a new collection under the Collections section to store your CoinGecko API requests. Consider giving the collection a meaningful name.

Now your screen should look similar to this:

Open Postman and Create a New Collection to Store Requests

Step 2: Authorize the API with an API Key

For APIs with keyed authentication, every request needs to be authorized. In the case for CoinGecko API, it needs to be authorized either by passing the API key in the header or as query parameters. For this walkthrough, we will add the CoinGecko API key to the header of each request.

Since we have multiple API endpoints to test, copying and pasting the API key into the headers of each request can be tedious. To simplify this, we will use Postman’s Header Presets to add the API key once and use it whenever needed.

To do this, create a new request and add the API key as a headers preset. Click on the donut menu (the three vertical dots) of the collection you created initially and select 'Add Request'. This will display a request boilerplate screen.

Authorize the API with an API Key - postman api testing guide

Next, navigate to the 'Headers' tab – you’ll see the headers section for the request. At the end of this section, you'll find a 'Presets' dropdown. Click on it and then select 'Manage Presets'. A 'Manage Header Presets' popup will appear.

In this popup, click on 'Add Header Preset'. You’ll be asked to provide a name for the preset. Under the 'Key' column, enter 'x-cg-pro-api-key', and in the 'Value' column, enter the API key generated earlier. Finally, click the 'Add' button.

Enter the CoinGecko API key generated

Now, your header preset is created and ready to be used for any request.

Step 3: Enter Requests & Parameters for Specific Endpoints

This section will focus on entering requests and parameters using CoinGecko API endpoints as examples.

Select the HTTP method

Depending on what you want to do with the endpoint, the HTTP request method could be GET (retrieve data from the server), POST (send data to the server for processing), PUT (replace a resource) etc.
Choose the HTTP method

Enter the Request URL

Enter the Request URL of the specific endpoint you'd like to test. For example, if you’re trying to get data for a specific cryptocurrency with the /coins/id endpoint, your Request URL will be: https://api.coingecko.com/api/v3/coins/bitcoin.
Enter the Request URL

Enter the Parameters

These are additional pieces of information that you can include in your request to specify or filter the data you’re asking for. Parameters are added to the end of the URL after a question mark ('?'). For example, if you only wanted to get data from the last 24 hours, your URL will appear as: https://api.coingecko.com/api/v3/coins/bitcoin?time_period=24h.
Enter the Parameters

Send the Request

Once you’ve selected the HTTP request method, entered the request URL and specified parameters, you can send the request. The API will return a response accordingly.
Send the Request

Handling the API Response

The API will return data based on your request. You’ll need to handle this data in your application. This could involve parsing the data, error handling, or updating the UI of your application.
Handle the Response

In this section, we'll share how you can use Postman to test various endpoints.

Coin Price By IDs

The /simple-price endpoint allows us to query the live or historical price data for specific cryptocurrencies listed on CoinGecko, by using their unique coin IDs.

💡Pro-tip: Here's a publicly available list of coin IDs, courtesy of the CoinGecko team!

You can specify one or multiple coin IDs in your request, and optionally include data points around market cap, 24-hour trading volume, 24-hour price percentage change and more, depending on the parameters of your query.

In Postman, we'll set up our request by choosing the GET method and entering the above endpoint into the URL field.

  • HTTP Method: GET
  • Request URL: https://api.coingecko.com/api/v3/simple/price
  • View query params on our API docs

 Use the header preset as shared in the previous section, to ensure your request is authenticated with the API key.

For this endpoint, there are 2 required parameters and 5 optional parameters, that you can include in the Params section of the Postman request:

After adding required parameters, send the request. The response structure should look like this:

{
  "bitcoin": {
    "usd": 67187.33589365664,
    "usd_market_cap": 1317802988326.2493,
    "usd_24h_vol": 31260929299.52484,
    "usd_24h_change": 3.637278946773539,
    "last_updated_at": 1711356300
  }
}

Note: The response may vary according depending on your request parameters.

Top Gainers and Losers

The /coins/top_gainers_losers endpoint allows us to query the top 30 coins with largest price gains and losses within a specific time frame. Please note that this is a paid exclusive endpoint and requires you to be subscribed to a paid plan in order to call the 'pro-api.coingecko.com' root URL.

💡Pro-tip: The response will only include coins with a 24-hour trading volume of at least $50,000.

Similarly, set up your request in Postman:

  • HTTP Method: GET
  • Request URL: https://pro-api.coingecko.com/api/v3/coins/top_gainers_losers
  • View query params on our API docs

After sending the request, the response structure should appear as follows:

[
  {
    "top_gainers": [
      {
        "id": "bonk",
        "symbol": "bonk",
        "name": "Bonk",
        "image": "https://assets.coingecko.com/coins/images/28600/original/bonk.jpg?1696527587",
        "market_cap_rank": 75,
        "usd": 0.000024645873833743326,
        "usd_24h_vol": 105344205.63389413,
        "usd_1y_change": 4244.15510979623
      },
      {
        "id": "0x0-ai-ai-smart-contract",
        "symbol": "0x0",
        "name": "0x0.ai: AI Smart Contract",
        "image":     "https://assets.coingecko.com/coins/images/28880/original/0x0.png?1696527857",
        "market_cap_rank": 235,
        "usd": 0.38823618283839084,
        "usd_24h_vol": 1608196.5698900486,
        "usd_1y_change": 3688.2499678083855
      }
    ]
  }
]

Note: The response may vary according depending on your request parameters.

Coins List with Market Data

The /coins/markets endpoint allows us to fetch real-time crypto price, trading volume over the last 24 hours, its market cap, and other relevant metrics for specific cryptocurrencies. This information is crucial for traders, analysts, and developers who need up-to-date and accurate data to make informed decisions regarding investments, market strategies, or application integrations.

Set up your request in Postman accordingly:

  • HTTP Method: GET
  • Request URL: https://api.coingecko.com/api/v3/coins/markets
  • View query params on our API docs

 

After sending the request, the response structure should appear as follows:

[
  {
    "id": "bitcoin",
    "symbol": "btc",
    "name": "Bitcoin",
    "image": "https://assets.coingecko.com/coins/images/1/large/bitcoin.png?1696501400",
    "current_price": 70187,
    "market_cap": 1381651251183,
    "market_cap_rank": 1,
    "fully_diluted_valuation": 1474623675796,
    "total_volume": 20154184933,
    "high_24h": 70215,
    "low_24h": 68060,
    "price_change_24h": 2126.88,
    "price_change_percentage_24h": 3.12502,
    "market_cap_change_24h": 44287678051,
    "market_cap_change_percentage_24h": 3.31157,
    "circulating_supply": 19675987,
    "total_supply": 21000000,
    "max_supply": 21000000,
    "ath": 73738,
    "ath_change_percentage": -4.77063,
    "ath_date": "2024-03-14T07:10:36.635Z",
    "atl": 67.81,
    "atl_change_percentage": 103455.83335,
    "atl_date": "2013-07-06T00:00:00.000Z",
    "roi": null,
    "last_updated": "2024-04-07T16:49:31.736Z"
  }
]

Note: The response may vary according depending on your request parameters.

Coin Data by ID

Call the /coins/id endpoint in the CoinGecko API to return crypto price, market data, metadata and exchange tickers for a cryptocurrency, as specified by the coin id parameter. This endpoint is useful for obtaining in-depth information about a particular coin, providing insights beyond market performance. When querying the API with a specific coin ID, it returns a dataset that includes:

  • Basic information: The coin's name, symbol, and description
  • Market data: Current price, market capitalization, 24-hour trading volume, price changes, and more
  • Historical data: Historical price data for specified timeframes, which is valuable for trend analysis
  • Developer data: Information about the coin's development activity, such as repository statistics and commit history
  • Community data: Metrics related to the coin's community engagement, like social media followers and forum activity
  • Supply information: Total and circulating supply of the coin
  • Additional metadata: Links to the coin's official website, whitepapers, and other relevant resources

Set up your request in Postman accordingly:

  • HTTP Method: GET
  • Request URL: https://api.coingecko.com/api/v3/coins/
    • https://api.coingecko.com/api/v3/coins/bitcoin
    • https://api.coingecko.com/api/v3/coins/ethereum
  • View query params on our API docs
💡Pro-tip: CoinGecko tracks 14,000+ cryptocurrencies (accurate at the time of publishing this article). The dynamic request URL structure allows users to programmatically fetch data for different coins, by substituting the {id} accordingly.

After adding the required parameters and sending the request, the response structure will be an array of objects appearing as such (for the 'bitcoin' id):

{
  "id": "bitcoin",
  "symbol": "btc",
  "name": "Bitcoin",
  "web_slug": "bitcoin",
  "asset_platform_id": null,
  "platforms": {
    "": ""
  },
  "detail_platforms": {
    "": {
      "decimal_place": null,
      "contract_address": ""
    }
  },
  "block_time_in_minutes": 10,
  "hashing_algorithm": "SHA-256",
  "categories": [
    "FTX Holdings",
    "Cryptocurrency",
    "Proof of Work (PoW)",
    "Layer 1 (L1)"
  ],
  "preview_listing": false,
  "public_notice": null,
  "additional_notices": [],
  "description": {
    "en": "Bitcoin is the first successful internet money based on peer-to-peer      technology...</a>.",
    "de": ""
  },
  "links": {
    "homepage": [
      "http://www.bitcoin.org",
      "",
      ""
    ],
    "whitepaper": "https://bitcoin.org/bitcoin.pdf",
    "blockchain_site": [
      "https://mempool.space/",
      "https://blockchair.com/bitcoin/",
      "https://btc.com/",
      "https://btc.tokenview.io/",
      "https://www.oklink.com/btc",
      "https://3xpl.com/bitcoin"
    ],
    "official_forum_url": [
      "https://bitcointalk.org/"
    ],
    "chat_url": [
      ""
    ],
    "announcement_url": [
      "",
      ""
    ],
    "twitter_screen_name": "bitcoin",
    "facebook_username": "bitcoins",
    "bitcointalk_thread_identifier": null,
    "telegram_channel_identifier": "",
    "subreddit_url": "https://www.reddit.com/r/Bitcoin/",
    "repos_url": {
      "github": [
        "https://github.com/bitcoin/bitcoin",
        "https://github.com/bitcoin/bips"
      ],
      "bitbucket": []
    }
  },
  "image": {
    "thumb": "https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1696501400",
    "small": "https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1696501400",
    "large": "https://assets.coingecko.com/coins/images/1/large/bitcoin.png?1696501400"
  },
  "country_origin": "",
  "genesis_date": "2009-01-03",
  "sentiment_votes_up_percentage": 84.07,
  "sentiment_votes_down_percentage": 15.93,
  "watchlist_portfolio_users": 1541900,
  "market_cap_rank": 1,
  "status_updates": [],
  "last_updated": "2024-04-07T15:24:51.021Z",
}

Conclusion

We've provided a comprehensive walkthrough on how to easily test APIs using Postman, with live examples using specific CoinGecko API endpoints. It covers the prerequisites, setting up Postman, authorizing the API with a key, and making requests to various endpoints.

By following this guide, developers, traders, and analysts can gain reliable access to the most recent market data offered by CoinGecko. Those looking to make the most of the comprehensive range of cryptocurrency data provided by CoinGecko API can find out more below!

CoinGecko API plans and pricing - coinmarketcap api alternative

CoinGecko's Content Editorial Guidelines
CoinGecko’s content aims to demystify the crypto industry. While certain posts you see may be sponsored, we strive to uphold the highest standards of editorial quality and integrity, and do not publish any content that has not been vetted by our editors.
Learn more
Want to be the first to know about upcoming airdrops?
Subscribe to the CoinGecko Daily Newsletter!
Join 600,000+ crypto enthusiasts, traders, and degens in getting the latest crypto news, articles, videos, and reports by subscribing to our FREE newsletter.
Tell us how much you like this article!
Vote count: 6
Roxait
Roxait
With 18 years of pioneering experience in the crypto space, Roxait excels in technical collaborations to develop cutting-edge decentralized solutions. Our commitment to innovation and expertise in blockchain technology has made us a trusted partner in driving the future of decentralized systems. Follow the author on Twitter @roxaittech

Related Articles

Select Currency
Suggested Currencies
USD
US Dollar
IDR
Indonesian Rupiah
TWD
New Taiwan Dollar
EUR
Euro
KRW
South Korean Won
JPY
Japanese Yen
RUB
Russian Ruble
CNY
Chinese Yuan
Fiat Currencies
AED
United Arab Emirates Dirham
ARS
Argentine Peso
AUD
Australian Dollar
BDT
Bangladeshi Taka
BHD
Bahraini Dinar
BMD
Bermudian Dollar
BRL
Brazil Real
CAD
Canadian Dollar
CHF
Swiss Franc
CLP
Chilean Peso
CZK
Czech Koruna
DKK
Danish Krone
GBP
British Pound Sterling
GEL
Georgian Lari
HKD
Hong Kong Dollar
HUF
Hungarian Forint
ILS
Israeli New Shekel
INR
Indian Rupee
KWD
Kuwaiti Dinar
LKR
Sri Lankan Rupee
MMK
Burmese Kyat
MXN
Mexican Peso
MYR
Malaysian Ringgit
NGN
Nigerian Naira
NOK
Norwegian Krone
NZD
New Zealand Dollar
PHP
Philippine Peso
PKR
Pakistani Rupee
PLN
Polish Zloty
SAR
Saudi Riyal
SEK
Swedish Krona
SGD
Singapore Dollar
THB
Thai Baht
TRY
Turkish Lira
UAH
Ukrainian hryvnia
VEF
Venezuelan bolívar fuerte
VND
Vietnamese đồng
ZAR
South African Rand
XDR
IMF Special Drawing Rights
Cryptocurrencies
BTC
Bitcoin
ETH
Ether
LTC
Litecoin
BCH
Bitcoin Cash
BNB
Binance Coin
EOS
EOS
XRP
XRP
XLM
Lumens
LINK
Chainlink
DOT
Polkadot
YFI
Yearn.finance
Bitcoin Units
BITS
Bits
SATS
Satoshi
Commodities
XAG
Silver - Troy Ounce
XAU
Gold - Troy Ounce
Select Language
Popular Languages
EN
English
RU
Русский
DE
Deutsch
PL
język polski
ES
Español
VI
Tiếng việt
FR
Français
PT
Português
All Languages
AR
العربية
BG
български
CS
čeština
DA
dansk
EL
Ελληνικά
FI
suomen kieli
HE
עִבְרִית
HI
हिंदी
HR
hrvatski
HU
Magyar nyelv
ID
Bahasa Indonesia
IT
Italiano
JA
日本語
KO
한국어
LT
lietuvių kalba
NL
Nederlands
NO
norsk
RO
Limba română
SK
slovenský jazyk
SL
slovenski jezik
SV
Svenska
TH
ภาษาไทย
TR
Türkçe
UK
украї́нська мо́ва
ZH
简体中文
ZH-TW
繁體中文
Welcome to CoinGecko
Welcome back!
Login or Sign up in seconds
or
Sign in with . Not you?
Forgot your password?
Didn't receive confirmation instructions?
Resend confirmation instructions
Password must contain at least 8 characters including 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character
By continuing, you acknowledge that you've read and agree fully to our Terms of Service and Privacy Policy.
Forgot your password?
You will receive an email with instructions on how to reset your password in a few minutes.
Resend confirmation instructions
You will receive an email with instructions for how to confirm your email address in a few minutes.
Get the CoinGecko app.
Scan this QR code to download the app now App QR Code Or check it out in the app stores
coingecko
Continue in app
Track prices in real-time
Open App