Skip to content

Latest commit

 

History

History
67 lines (55 loc) · 6.93 KB

File metadata and controls

67 lines (55 loc) · 6.93 KB

API

What is API & REST API ? 9/10/23
10 Web APIs Every Senior Web Engineer Should Master! 7/9/23
7 More JavaScript Web APIs to Build Futuristic Websites you didn't Know 🤯 6/28/23
Watching for changes to a user's location 6/27
How to setup a middleman API with vanilla JS 5/1
API credentials and security with vanilla JS 4/29
API authentication with vanilla JS 4/28
How to Use the Web Storage API 2/21
How to Detect When a Sticky Element Gets Pinned 11/13
localStorage The read-only localStorage property allows you to access a Storage object for the Document's origin; the stored data is saved across browser sessions. localStorage is similar to sessionStorage, except that while data stored in localStorage has no expiration time, data stored in sessionStorage gets cleared when the page session ends — that is, when the page is closed.
fetch The Fetch API provides an interface for fetching resources (including across the network). It will seem familiar to anyone who has used XMLHttpRequest, but the new API provides a more powerful and flexible feature set.
    const baseEndpoint = 'https://api.github.com';
    const usersEndpoint = `${baseEndpoint}/users`;
    const userEl = document.querySelector('.user');

    async function displayUser(username) {
      userEl.textContent = 'loading...';
      const response = await fetch(`${usersEndpoint}/${username}`);
      const data = await response.json();
      console.log(data);
      console.log(data.blog);
      console.log(data.name);
      console.log(data.location);
      userEl.textContent = `${data.name} - ${data.blog}`;
    }

    function handleError(err) {
      console.log('OH NO!');
      console.log(err);
      userEl.textContent = `Something went wrong: ${err}`
    }

    displayUser('stolinski').catch(handleError);
http://api.github.com/users/johnpdang
https://exchangeratesapi.io/
https://github.com/public-apis/public-apis
https://icanhazdadjoke.com/api
http://recipepuppy.com/api
http://recipepuppy.com/api/

//parameters
?
i=onions,garlic //ingredients
&
q=omelet //query
&
p=3 //pagination