API Requests JS

JavaScript requests Demystified.

Think Python requests but for JavaScript.

npm i api-request-js
npm i api-request-js

😧 There's a problem...

Getting data from an API is complex and hard in JavaScript. A quick google search will direct you to a difficult code block that either use fetch or axios.
This SCARES off beginners.

  • Which one do I use?
  • Like what is the await keyword?
  • When do I use it?
  • But wait what is async?
  • How does async even work?
  • How do I error handle? .catch?
  • I can't even download an image from this url!! Ahhrr!!!
  • What's a Promise? Whaaa?!!??

This totals over 30 lines of code (depending on your use case). Meanwhile in Python it's literally one line requests.get(url).

With api-request-js we dumb down api calls. Now you can get data with just one line.

🚀 Let's Get Started!

🌐 Import in Your Project

After installation, import the package!

const request = require("api-request-js")

🥇 Just One Line

After installation, import the package!

The .getRequest(url, path) gets the data from the API endpoint!

Parameters:
url is a required string parmeter
path is optional string parameter. path is the directory you want to download images to on your device. This is only used for endpoints that generate images.

let data = request.getRequest(url, path)

🖨️ Print out the Data

Log out the data!

The .log(data) outputs the data

request.log(data)

🔗 Test it out!

  • People in Space Now API

  • Coinbase Currencies API

  • Coindesk Current Price API

  • Art Institute of Chicago API

  • Check Domain API

  • English Dictionary API

  • Spaceflight News API

  • Cat Image Generator API

  • Unsplash Image Generator API

  • ZenQuotes API

  • US University Finder API

  • Cat Fact API

  • UUID Generator API

  • Newton Math Equation Solver API

  • Toronto TTC API

  • Football Matches API

  • City Bike Networks API

  • Breaking Bad Quotes API

img

Need Help? Watch our Video!

img
imgimg