Base URL
https://rayofood.yourdomain.com/api
Authentication
Currently, no authentication is required for testing endpoints.
Categories API
/categories
Retrieve all categories
/categories/:id
Retrieve a specific category by ID
/categories
Create a new category
{
"name": "Beverages"
}
/categories/:id
Update an existing category
/categories/:id
Delete a category (use ?cascade=true to handle products)
Products API
/products
Retrieve all products with category information
/products/:id
Retrieve a specific product by UUID
/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"
}
/products/barcode/:barcode
Find product by barcode
/products/category/:categoryId
Get all products in a specific category
Ingredients API
/ingredients
Retrieve all ingredients
/ingredients
Create a new ingredient
{
"name": "Organic Sugar",
"description": "Natural organic sugar",
"allergens": "None",
"nutrition_info": "400 calories per 100g"
}
Product-Ingredients API
/products/:productId/ingredients/:ingredientId
Add ingredient to product
{
"quantity": "100g"
}
/products/:productId/ingredients
Get all ingredients for a product
/products/:productId/ingredients/:ingredientId
Update ingredient quantity in product
/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
- 200 - Success
- 201 - Created
- 400 - Bad Request (validation error)
- 404 - Not Found
- 409 - Conflict (duplicate entry)
- 500 - Internal Server Error
Testing
You can test these endpoints using tools like:
- Postman
- curl
- Insomnia
- Your favorite REST client
Need help? Contact us at contact@rayofood.com