example-data.com
Menu
Browse docs and collections

Overview

ingredients / #108

Mushrooms

Component variants

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/ingredients/108" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/ingredients/108"
);
const ingredient = await res.json();

TypeScript example

// Download once: mkdir -p types && curl -o types/ingredients.d.ts https://example-data.com/types/ingredients.d.ts
import type { Ingredient } from "./types/ingredients";

const res = await fetch(
  "https://example-data.com/api/v1/ingredients/108"
);
const ingredient = (await res.json()) as Ingredient;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/ingredients/108"
)
ingredient = res.json()

Response

{
  "id": 108,
  "name": "Mushrooms",
  "slug": "mushrooms-108",
  "foodCategoryId": null,
  "unit": "g",
  "defaultPricePerUnit": 22.87,
  "currency": "USD"
}