I’ve written this article for people who know a little about APIs and how they work. If you want to learn about and understand APIs in a simple way, you can subscribe on BWT and I'll let you know as soon as I drop the article for that.
APIs are a sort of mechanism that allows you to interact between applications, they also allow you access data from these applications and give more functionality to what you are building.
One of the most common types of APIs are REST APIs. If you’ve ever interacted with APIs or read a documentation, you’ll find that most of them are written in this way. However there are other kinds of APIs, one of which is called GraphQL . In dealing with APIs over the last few months, I’ve come across GraphQL APIs which are not so compatible with a number of no-code tools.
In this short article, I’ll explain how you can convert them to the common REST APIs. You can also use this if you’re a developer. For this, I’m going to use Buycoins API which is written in GraphQL. You can take a look at it to follow along or you can use any GraphQL API you choose.
Let’s get into it.
We’re using a sample request from the Buycoins API which we’ll be testing in Postman. This request is to generate a deposit link via Buycoin’s Sendcash Pay.
Convert the query to a JSON format
The first thing to do would be to convert the query of your GraphQL request to a JSON format.
Copy the converted string and paste it in the body of the request on Postman. Select POST as the method and paste the endpoint in the field for the request URL.
Add the Authorization Keys
Buycoins uses Basic Authentication with my public key as username and secret key as password, so I’ve set that up in the Authorization tab of Postman. This part could vary with different applications so just be sure to read their documentation.
Modify the body of the request
This part is super important.
Delete the “:null” just before the last parenthesis and add ““query”:” right after the first parenthesis.
Run your request
If you used the Buycoins API, you should get a response like in the image below with the deposit link created.
You could try it out and let me know it goes. I’m contemplating on working on a small project to rewrite GraphQL API documentations as REST API documentations so if you have any you’d like me to take a look at, please tweet at me.
If you liked this article, make sure to share it with someone.
If you’d like to leave feedback, you can send a DM or leave a comment below.
Need help with the build or anything no-code related? Send an email.