← Back to Home

🌮 RayoFood API Documentation

Complete reference for the RayoFood API endpoints

Base URL

https://rayofood.yourdomain.com/api

Authentication

Currently, no authentication is required for testing endpoints.

Categories API

GET/categories

Retrieve all categories

GET/categories/:id

Retrieve a specific category by ID

POST/categories

Create a new category

{
  "name": "Beverages"
}
            
PUT/categories/:id

Update an existing category

DELETE/categories/:id

Delete a category (use ?cascade=true to handle products)

Products API

GET/products

Retrieve all products with category information

GET/products/:id

Retrieve a specific product by UUID

POST/products

Create a new product

{
  "name": "Organic Avocado",
  "description": "Fresh organic avocado",
  "category_id": 1,
  "price": 2.99,
  "barcode": "123456789",
  "image_url": "https://example.com/avocado.jpg",
  "nutrition_info": "High in healthy fats"
}
            
GET/products/barcode/:barcode

Find product by barcode

GET/products/category/:categoryId

Get all products in a specific category

Ingredients API

GET/ingredients

Retrieve all ingredients

POST/ingredients

Create a new ingredient

{
  "name": "Organic Sugar",
  "description": "Natural organic sugar",
  "allergens": "None",
  "nutrition_info": "400 calories per 100g"
}
            

Product-Ingredients API

POST/products/:productId/ingredients/:ingredientId

Add ingredient to product

{
  "quantity": "100g"
}
            
GET/products/:productId/ingredients

Get all ingredients for a product

PUT/products/:productId/ingredients/:ingredientId

Update ingredient quantity in product

DELETE/products/:productId/ingredients/:ingredientId

Remove ingredient from product

Response Format

All successful responses return JSON data. Error responses include an error field with a descriptive message.

Success Example:

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "Organic Avocado",
  "category_name": "Fresh Produce",
  "price": 2.99,
  "created_at": "2025-09-04T12:00:00Z"
}
        

Error Example:

{
  "error": "Product name is required and must be a string"
}
        

Status Codes

Testing

You can test these endpoints using tools like:

Need help? Contact us at contact@rayofood.com