Crypto API tutorials and more:
PancakeSwap is a popular decentralized exchange built on the Binance Smart Chain (BSC). We can use the PancakeSwap API to obtain liquidity and volume information from the PancakeSwap platform. In this tutorial, we’ll show you how to connect the PancakeSwap REST API to Google Sheets in 4 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
In this section, we’ll show you how to browse the PancakeSwap API documentation to find the endpoint that retrieves the information you need from your account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 3.
First, open the PancakeSwapAPI documentation page: https://github.com/pancakeswap/pancake-info-api/blob/develop/v2-documentation.md
This page contains general information about the PancakeSwap API and a list of endpoints:
If you scroll down, you will find the endpoints:
An example endpoint is /v2/tokens, which returns the tokens in the top ~1000 pairs on PancakeSwap, sorted by their reserves.
Each endpoint’s documentation contains a short description of its purpose, its HTTP method and URI, and an example response.
All endpoints can be accessed with the following base domain: https://api.pancakeswap.info/
The /v2/tokens/0x… endpoint, which returns the token information, based on address:
Method: GET API URL Path: https://api.pancakeswap.info/api/v2/tokens/address_value
Don’t forget to replace address_value wit a real address.
The /v2/pairs endopoint, which returns data for the top ~1000 PancakeSwap pairs, sorted by reserves:
Method: GET API URL Path: https://api.pancakeswap.info/api/v2/pairs
Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import tab open, enter these details into the add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.
API URL: In Step 2, we explained how you can find the PancakeSwap REST API endpoint that you need. Now copy and paste your complete PancakeSwap API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).
For this example, we are using the /v2/summary endpoint, which returns data for the top ~1000 PancakeSwap pairs, sorted by their reserves. This is what the whole URL looks like:
https://api.pancakeswap.info/api/v2/summary
No keys required. Here’s what our request looks like entered in Apipheny:
Another example endpoint is /v2/tokens endpoint that returns the tokens in the top ~1000 pairs on PancakeSwap, sorted by their reserves. This is what the whole URL looks like:
https://api.pancakeswap.info/api/v2/tokens
Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the PancakeSwap API data to be imported into your Google Sheet. Here’s what our request looked like when completed.
/v2/summary endpoint result:
/v2/tokens endpoint result:
After making a successful request to the PancakeSwap API, try querying a different PancakeSwap API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Crypto API tutorials and more:
Sponsored by Zink Virtual Tip Jar & Rewording.io Paraphrasing Tool
Accept donations on Twitch | Accept donations on Discord | Accept donations on YouTube | Accept donations on Telegram | Accept donations on Twitter | Accept donations on TikTok | Accept donations on Instagram | Accept donations on LinkedIn | Accept donations on Facebook | Accept donations on your Website
Crypto API tutorials and more: