Tea API Documentation

Welcome to the Tea API! Below are some examples of how you can interact with it.

Get all products

fetch("https://tea-api-gules.vercel.app/api")
.then((res) => res.json())
.then((data) => console.log(data));

Get a single product

fetch("https://tea-api-gules.vercel.app/api/1")
.then((res) => res.json())
.then((data) => console.log(data));

Limit results

fetch("https://tea-api-gules.vercel.app/api?limit=2")
.then((res) => res.json())
.then((data) => console.log(data));

Sort results

fetch("https://tea-api-gules.vercel.app/api?sort=desc")
.then((res) => res.json())
.then((data) => console.log(data));

Add a new product

fetch("https://tea-api-gules.vercel.app/api", {
  method: "POST",
  body: JSON.stringify({
    name: "Herbal Bliss",
    description: "Relaxing herbal tea",
    price: 5.99,
    region: "Asia"
  })
})
.then((res) => res.json())
.then((data) => console.log(data));

Delete a product

fetch("https://tea-api-gules.vercel.app/api/1", {
  method: "DELETE"
})
.then((res) => res.json())
.then((data) => console.log(data));

Sample Product JSON

{`[{ "_id": "6424335b59f9f6fdd657d2e1", "id": 1, "name": "Chakour", "description": "A refreshing and aromatic blend of green tea and fresh mint leaves, with hints of sweetness and a cooling effect. This tea is a staple in Moroccan culture, enjoyed daily across the country.", "price": 8.99, "region": "Morocco", "weight": 250, "flavor_profile": ["Mint", "Herbaceous", "Sweet"], "brewing_method": ["Traditional Pot", "Glass", "Mint Tumbler"], "steep_level": "Medium", "image_url": "https://res.cloudinary.com/dlhbc051y/image/upload/v1706903483/uploads/yb5gsogwm9jjfjbhjqkl.png" }]`}