xxxxxxxxxx
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(response => response.json())
.then(json => console.log(json))
xxxxxxxxxx
---- JSON Placeholder free JSON API --------------------------
https://jsonplaceholder.typicode.com/posts | 100 posts
https://jsonplaceholder.typicode.com/comments | 500 comments
https://jsonplaceholder.typicode.com/albums | 100 albums
https://jsonplaceholder.typicode.com/photos | 5000 photos
https://jsonplaceholder.typicode.com/todos | 200 todos
https://jsonplaceholder.typicode.com/users | 10 users
Fetch single entity (add /:id):
https://jsonplaceholder.typicode.com/posts/1
https://jsonplaceholder.typicode.com/users/3
https://jsonplaceholder.typicode.com/photos/12
--------------------------------------------------------------
Add delay to the JSON Placeholder API: ?_delay=MILLISECONDS
https://jsonplaceholder.typicode.com/todos/1?_delay=2000
(You might also want to check similar JSON projects: https://dummyjson.com/docs/products and https://fakestoreapi.com/)
jsonplaceholder
xxxxxxxxxx
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(response => response.json())
.then(json => console.log(json))
xxxxxxxxxx
fetch('https://jsonplaceholder.typicode.com/todos/2')
.then(response => response.json())
.then(json => console.log(json))
xxxxxxxxxx
fetch('https://jsonplaceholder.typicode.com/todos/2')
.then(response => response.json())
.then(json => console.log(json))
xxxxxxxxxx
fetch('https://jsonplaceholder.typicode.com/todos')
.then(response => response.json())
.then(json => console.log(json))
xxxxxxxxxx
fetch('https://jsonplaceholder.typicode.com/todos/2')
.then(response => response.json())
.then(json => console.log(json))
xxxxxxxxxx
fetch('https://jsonplaceholder.typicode.com/todos/2')
.then(response => response.json())
.then(json => console.log(json))
xxxxxxxxxx
axios
.get("https://jsonplaceholder.typicode.com/posts")
.then(function (response) {
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.then(function () {
// always executed
});
xxxxxxxxxx
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(response => response.json())
.then(json => console.log(json))
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(response => response.json())
.then(json => console.log(json))