Skip to main content

Global Food Products & Barcodes (Open Food Facts + USDA)

Comprehensive global food catalog integrating Open Food Facts and USDA FoodData Central. Query products by commercial barcode (EAN-13, UPC), manufacturer brand, localized product title, categories, and country of origin with multi-currency pricing.

Pełny adres URL https://www.dietspremium.com/api/v1/food-world
Format odpowiedzi application/json; charset=utf-8
Autoryzacja Authorization: Bearer <API_KEY>
Specyfikacja Parametrów HTTP

Request Parameters

6 Parameter
Parameter Data Type Requirement Description Example
query string Optional Product name or keywords (e.g. "Coca-Cola Zero", "Nutella") —
barcode string Optional EAN-13 or UPC barcode string (e.g. "5449000000996") —
brand string Optional Manufacturer / brand name (e.g. "Barilla", "Nestle") —
locale string Optional Target language locale en
currency string Optional Currency for pricing (EUR, PLN, USD, ALL) locale default
page integer Optional Pagination page index 1
Diagnostyka i Odporność

HTTP Status Codes

Kod HTTP Status Znaczenie i Obsługa
200 OK Sukces Request processed successfully
400 Bad Request Błąd walidacji Invalid request parameters
401 Unauthorized Brak autoryzacji Missing or invalid X-API-KEY
429 Too Many Requests Rate Limit Rate limit or quota exceeded
500 Server Error Błąd serwera Internal server error

Example HTTP Request

POST /api/v1/food-world
terminal — POST /api/v1/food-world
REST HTTP/2 REQUEST
curl -X POST 'https://www.dietspremium.com/api/v1/food-world'
curl -X POST "https://www.dietspremium.com/api/v1/food-world" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
  "query": "barilla spaghetti",
  "brand": "Barilla",
  "locale": "pl",
  "currency": "ALL"
}'

Example JSON Response (200 OK)

HTTP/2 200 OK • application/json
response — /api/v1/food-world (200 OK)
JSON Payload 200 OK
{
  "items": [
    {
      "id": 104291,
      "name": "Spaghetti n.5",
      "brand": "Barilla",
      "barcode": "8076809513753",
      "nutriscore_grade": "a",
      "ecoscore_grade": "b",
      "kcal": 359,
      "proteins": 12.5,
      "fats": 2.0,
      "carbs": 70.9,
      "has_price": true,
      "price": {
        "amount": 1.49,
        "currency": "EUR"
      }
    }
  ],
  "total": 1,
  "page": 1
}
Obsługa paginacji i filtrów dla /api/v1/food-world Best Practice

Zalecenia produkcyjne dla deweloperów

1
Kontrola strony i rozmiaru kolekcji page / max_results

Sprawdzaj flagę "hasMore" oraz "total" w odpowiedzi JSON przed pobraniem kolejnej strony.

2
Wyszukiwanie semantyczne vs dokładne ai=true

Ustaw ai=true dla zapytań w języku naturalnym lub ai=false dla ścisłego dopasowania słów kluczowych.

ApiClient_food_world 200 OK

Klient HTTP dla zasobu Global Food Products & Barcodes (Open Food Facts + USDA)

REST API v1 + OpenSearch
Prompt Wejściowy Agenta AI

“Pobierz dane z /api/v1/food-world dla języka EN z użyciem wektora k-NN.”

Wykorzystywane Narzędzia MCP / Endpointy
POST /api/v1/food-world
Ślad Wywołania (Execution Trace)
→ POST /api/v1/food-world (locale=en, ai=true)
← 200 OK (application/json)

Other REST API Endpoints

Pełny katalog REST API →

Share