top of page

REST API Client

RESTAPIIntegration | SQL |APItoSQL | CodingSimplified | RapidAPI

Unlock REST API to SQL Magic with InDriver in Minutes!

In just a few lines of code, seamlessly connect REST APIs with SQL databases.

 

Embrace unmatched performance and flexibility with streamlined coding. Turn your ideas into reality more quickly than you ever imagined.

 

Wave goodbye to:

  • the limitations of rigid, non-interactive forms that force you to build REST API requests in predefined forms,

  • the high costs of per-request billing,

  • the API request interval constraints,

found in many popular solutions like Postman, Azure Data Factory, Zapier, and IFTTT.

Ready to revolutionize your development process?

Discover the ease of deploying a RestApi client with InDriver through a RapidAPI 'Fear&Greed Index' integration example:

This guide covers the setup in an 'onStartup' script and operational procedures in an 'onHook' script, utilizing the built-in RestApi Object.

The 'onStartup' script is designed to prepare your InDriver task for operation.

This includes:

  • creating the destination SQL table if it doesn't already exist,

  • defining the interval at which queries will be made,

  • specifying the API request details.

RESTAPI Client onStartup Script

InDriver.import("RestApi");

InDriver.installHook(10000);

InDriver.sqlExecute("localserver","SELECT tsapicreatetable('public','fearandgreed');");

 

RestApi.defineRequest('fgi','{"url":"https://fear-and-greed-index.p.rapidapi.com/v1/fgi","timeout":5000, "type":"get","headers":{"ContentTypeHeader":"application/json","X-RapidAPI-Key": "API_KEY","X-RapidAPI-Host": "fear-and-greed-index.p.rapidapi.com"}}');

RESTAPI Client onHook Script

The 'onHook' script - It's here that the magic happens:

  • Executing the defined request, transforming the JSON string responses into actionable data.

  • Printing the results to the debug console for immediate feedback and extracting relevant data from the requests.

  • The extracted data is systematically logged into your SQL table to be used for analysis, reporting, or any other purpose you see fit.

let ts= InDriver.hookTs();

RestApi.sendRequest('fgi');

if (RestApi.isSucceeded()) {

const r = RestApi.getData('fgi');

const obj = JSON.parse(r);

InDriver.debug("CNN Fear & Greed Index :"+obj.lastUpdated.humanDate + " " + obj.fgi.now.value + " "+ obj.fgi.now.valueText+"\n JSON> " + r);

InDriver.sqlExecute("localserver",["SELECT tsapiinsert('public','fearandgreed','fgi','",ts,"','",r,"');"]);

}

Watch a video about REST API integration

InDriver, a REST API client, is a powerful bridge for automating the interaction between your systems and external web services. It simplifies sending requests to and receiving responses from RESTful APIs, a cornerstone of modern web interactions.

Read more in the blog Seamless Integration of Fear and Greed Index with Grafana Using InDriver

bottom of page