complete newbie, want to know the basics
Maybe this could help: https://www.taniarascia.com/how-to-connect-to-an-api-with-javascript/?
Best,
Eduardo Lopez
You’ll want to have a look at Fetch and/or Ajax calls in JavaScript for getting data from an API.
Use can use the fetch
command like so:
// Fetch data from https://jsonplaceholder.typicode.com/users
fetch("https://jsonplaceholder.typicode.com/users")
// Then get the JSON response
.then(response => {
return response.json();
})
// Finally, convert JSON to a string
.then(myJson => {
console.log(JSON.stringify(myJson));
});
A good practice API is this:
https://jsonplaceholder.typicode.com/users
You can learn more about fetch from:
1 Like