GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - whirlxd/fetch-data-from-api: How to fetch data from a restful api

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 

Repository files navigation

How to fetch Data from a restful api?

Hi! Im Whirl and im gonna teach you how to fetch data from a restful api

What is a API?

API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you're using an API.

How to make your own api?

This is not the topic of this tutorial but still you can view it here!

make sure to join that server to view

How to fetch data

1 - you need to be familiar with json (it is really easy )

2 - for this tutorial i'll use this api - https://brawlapi.com

3 - now go the brawlers page in endpoints category

4 - they have listed a endpoint there

5 - when you click on that link you see some text

6 - Now We would fetch that data and represent it on your console

7 - write this code -

 const fetch = require('node-fetch')//npm i node-fetch
fetch('https://api.brawlapi.com/v1/brawlers/16000038')
    .then(res => res.json())
    .then(json => console.log(json));

This would print what was on that endpoint page!

Now if you look closely they mention a brawler name , id , is released and much more !

How to get this content?

i'll use this method - console.log(json.name) - this would log the brawler name which in this case is surge

There may be some api's which have a more complicated json for which traditional javascript method of reading objects can be used!

Thanx To -

Whirl

About

How to fetch data from a restful api

Topics

apifetchhypenode-fetchrestful-apitutorial

Resources

Readme
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Contributors

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.