Create Publication

We are looking for publications that demonstrate building dApps or smart contracts!
See the full list of Gitcoin bounties that are eligible for rewards.

Tutorial Thumbnail
Beginner · 15 minutes or less

Importing the PureStake API Endpoints into Postman

Store the PureStake API endpoints in Postmand for easy, fast queries. It’s easy to import and save them to your account!

Requirements

None

Background

For more information on the PureStake API, here are some helpful links: * PureStake API site: https://developer.purestake.io/ * About the PureStake API: https://www.purestake.com/technology/algorand-api/ * The Postman documentation site: https://learning.postman.com/ * Code Samples: https://developer.purestake.io/code-samples * API Examples: https://github.com/PureStake/api-examples

Steps

1. Log into the PureStake API Portal

In order to import the collection of endpoints, you’ll need the JSON file. To retrieve yours, log into your PureStake API account. If you don’t already have a PureStake API key, refer to this tutorial.

EditorImages/2020/04/08 17:00/01-algorand-api-service-dashboard-alt.png

2. Download the Swagger JSON File

Once logged in, click over to the APIs section and choose the network (e.g., Algorand BetaNet, TestNet, or MainNet) in the left sidebar. Click the /swagger.json in the accordion menu to see more options. Click the Try it out button.

Alternativley, if you are already using the API, you can also request the JSON file with cURL or Postman.

EditorImages/2020/04/08 17:01/02-swagger-flyopen.png

Click Execute.

EditorImages/2020/04/08 17:03/02-swagger-flyopen-2.png

Scroll down to the Server response section. At the bottom of the Response body code editor, you will see a Download button. Click it.

EditorImages/2020/04/08 17:04/02-swagger-flyopen-3.png

This will download the Swagger JSON file that you will import into Postman.

3. Import the JSON into Postman

Open the Postman desktop application and log in, if you haven’t already. You’ll end up on this dashboard.

EditorImages/2020/04/08 17:05/03-postman-dashboard.png

Click on the Import button at the top of your screen.

EditorImages/2020/04/08 17:05/04-Postman-import.png

This will trigger a prompt. Select the JSON file from your downloads folder.

EditorImages/2020/04/08 17:06/05-Postman-import.png

When prompted, leave both Import as an API and Generate a Postman Collection checked.

EditorImages/2020/04/08 17:06/05-Postman-import-2.png

This will create a collection of API endpoints within Postman.

4. Verify the API Endpoints in Postman

Since you imported the endpoints directly from the PureStake API portal, they should work automagically. But just in case, here’s how you can verify them in Postman.

Select a GET request to complete from your new collection via the sidebar on the left. I’ll use /status for this example.

Make sure you enter your x-api-key in the header. I have mine saved as a preset, which you can do by clicking “Manage Presets.”

EditorImages/2020/04/08 17:08/07-status.png

After you’ve entered your API key, click Send. If you see a message like the following, the GET request was successful.

EditorImages/2020/04/08 17:09/09-run-query.png