Think Python requests but for JavaScript.
npm i api-request-js
npm i api-request-js
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.
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.
After installation, import the package!
const request = require("api-request-js")
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)
Log out the data!
The .log(data) outputs the data
request.log(data)
People in Space Now API
http://api.open-notify.org/astros.json?callback=?
Coinbase Currencies API
https://api.coinbase.com/v2/currencies
Coindesk Current Price API
https://api.coindesk.com/v1/bpi/currentprice.json
Art Institute of Chicago API
https://api.artic.edu/api/v1/artworks/129884
Check Domain API
https://api.domainsdb.info/v1/domains/search?domain=facebook
English Dictionary API
https://api.dictionaryapi.dev/api/v2/entries/en/hello
Spaceflight News API
https://api.spaceflightnewsapi.net/v3/info
Cat Image Generator API
http://thecatapi.com/api/images/get?format=src&type=gif
Unsplash Image Generator API
https://source.unsplash.com/random/
ZenQuotes API
https://zenquotes.io/api/today
US University Finder API
http://universities.hipolabs.com/search?country=United+States
Cat Fact API
https://catfact.ninja/fact
UUID Generator API
https://www.uuidtools.com/api/generate/v1
Newton Math Equation Solver API
https://newton.now.sh/api/v2/factor/x^2-1
Toronto TTC API
http://myttc.ca/finch_station.json
Football Matches API
https://api.football-data.org/v4/matches
City Bike Networks API
http://api.citybik.es/v2/networks
Breaking Bad Quotes API
https://api.breakingbadquotes.xyz/v1/quotes