Fake coffee api is a free online REST API that you can use whenever you need Pseudo-real data without running any server-side code. It's awesome for teaching purposes, sample codes, tests, coffee website etc.
Check out our documentation at https://fake-coffee-api.vercel.app/ to learn more on how to use our API.
fetch("https://fake-coffee-brand-api.vercel.app/api")
.then((res) => res.json())
.then((data) => console.log(data));
fetch("https://fake-coffee-brand-api.vercel.app/api/1")
.then((res) => res.json())
.then((data) => console.log(data));
fetch("https://fake-coffee-brand-api.vercel.app/api?limit=2")
.then((res) => res.json())
.then((data) => console.log(data));
sort in descending order
fetch("https://fake-coffee-brand-api.vercel.app/api?sort=desc")
.then((res) => res.json())
.then((data) => console.log(data));
sort in ascending order
fetch("https://fake-coffee-brand-api.vercel.app/api?sort=asc")
.then((res) => res.json())
.then((data) => console.log(data));
fetch("https://fake-coffee-brand-api.vercel.app/api/1", {
method: "PUT",
body: JSON.stringify({
name: "Golden sunset",
description: "A lovely taste of the sun",
price: 99.99,
region: "Africa",
}),
})
.then((res) => res.json())
.then((data) => console.log(data));
OR;
fetch("https://fake-coffee-brand-api.vercel.app/api/1", {
method: "PATCH",
body: JSON.stringify({
name: "Golden sunset",
descriptop: "A lovely taste of the sun",
price: 99.99,
region: "Africa",
}),
})
.then((res) => res.json())
.then((data) => console.log(data));
/* will return
[
{
id:5,
name: 'new name',
description: 'new description'
price: 'new price',
region: 'new region'
}
]
*/
Note: Edited data will not really be updated into the database.
fetch("https://fake-coffee-brand-api.vercel.app/api", {
method: "POST",
body: JSON.stringify({
name: "Heavenly Spice",
description: "Comforting",
price: 89.99,
region: "South Asia",
}),
})
.then((res) => res.json())
.then((data) => console.log(data));
/* will return
[
{
id:21,
name:'Heavenly Spice',
description:'Comforting',
price:89.99,
region:'South Asia'
}
]
*/
Note: Posted data will not really insert into the database and just return a fake id.
fetch('https://fake-coffee-brand-api.vercel.app/api/1,{method:"DELETE"}')
.then((res) => res.json())
.then((data) => console.log(data));
Nothing will delete on the database.
{
id:Number,
name:String,
description:String,
price:Number,
region:String,
weight:Number,
flavor_profile:Array,
grind_option:Array,
roast_level:Number,
}