How to use RapidQL to get data from multiple APIs and databases

Sat Oct 02 2021

2 min read

RapidQL lets developers query more than one API resource and database at a time, combining them to create one unified query.


RapidQL is an Open Source project by RapidAPI that allows you to aggregate data from multiple databases and Web APIs. Using a unified query enables you to fetch, combine and aggregate data in a single call.

It employs nesting to incorporate many inputs within one request. As a result, RapidQL makes it convenient to extract data from multiple sources simultaneously. The returned data can also be used concurrently to form further queries.

Single Call to Multiple APIs or Databases

What if you needed to use a Geolocation API to grab an address, detect the users' city and get the weather there using another Weather API? Or maybe you wanted to pull users' information from a database and verify their emails through a verification API simultaneously. RapidQl allows you to do all that and more in a single call.

How to use RapidQL


You can get started right away by installing the npm module.

npm install rapidql

Then you can go ahead and require it in your project before initializing it.

const RapidQL = require('RapidQL');
const rql = new RapidQL({}); // Default parameters and connection details can be initialized here.


Once you have initialized it, you can perform queries using the .query() method. It affords two arguments:

  1. The query string itself.
  2. (optional) The base context for passing any parameters in the queries.

Following is an example that combines two queries in a single call.

- MySQL.RQLDemo.rqlDemo.find(){
params: {
"units": "imperial",
"q" : city

First, it will send a request to the database for the city. Then, using the response, it will invoke the Open Weather API to find the weather in that city.

Pretty neat stuff, right? You can read the documentation and explore RapidQL further in its GitHub Repository.