The RapidAPI Developer Hub

Welcome to the RapidAPI developer hub. You'll find comprehensive guides and documentation to help you start working with RapidAPI as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Documentation


Query RapidAPI APIs using Node.js

To get started using Node.js to consume APIs on RapidAPI, download the RapidAPI SDK from NPM:

npm install rapidapi-connect --save

Once you've installed the SDK, require it in your code:

const RapidAPI = require('rapidapi-connect');

You can now instantiate a new RapidAPI client with your ProjectName and ProjectKey:

const rapid = new RapidAPI("ProjectName", "ProjectKey");

Now, to call an API, all you have to do is write the following code:

rapid.call('PackageName', 'FunctionName', { 
	'ParameterKey1': 'ParameterValue1',
	'ParameterKey2': 'ParameterValue2'
}).on('success', (payload)=>{
}).on('error', (payload)=>{

Notice that either the .on('success') or .on('error') function will be called following the execution. On success, payload will contain the data from the API. On error, payload will contain the error message.

Code snippets

In the code tab in the functions page, you can select NodeJS to autogenerate a NodeJS code for the function you're currently viewing.


Query RapidAPI APIs using Node.js