Contents
REST API — Plugixa Recipe
All plugin data is exposed through the plugixarecipe/v1 REST namespace. Use it to build custom frontends, headless sites, mobile apps, or to integrate with external services.
Base URL:
/wp-json/plugixarecipe/v1/…
Authentication
| Scenario | Auth |
|---|---|
| Public reads (list + detail) | None — configurable in Settings → API |
| Writes (POST / PATCH / DELETE) | WP REST nonce (cookie auth) or Application Password |
| External app | Application Password (Users → Profile → Application Passwords) |
Toggle public reads off in Settings → API to require authentication for every request.
Endpoints
Recipes
GET /recipes # List
GET /recipes/{id} # Detail
POST /recipes # Create
PATCH /recipes/{id} # Update
DELETE /recipes/{id} # Delete
POST /recipes/ordering # Persist drag-drop order
POST /recipes/{id}/duplicate # Clone
Filters: status, category, cuisine, course, difficulty, cost, diet_flag, featured, search, min_rating, language, orderby, order, page, per_page.
Example:
GET /wp-json/plugixarecipe/v1/recipes?cuisine=italian&per_page=20&orderby=rating_average&order=DESC
Categories, Cuisines, Courses
GET /categories
GET /categories/{id}
POST /categories
PATCH /categories/{id}
DELETE /categories/{id}
POST /categories/ordering
Repeat for /cuisines and /courses (courses are read-mostly and don’t support ordering).
Ingredients & Instructions
These are child resources under a recipe:
GET /recipes/{id}/ingredients
POST /recipes/{id}/ingredients # Replace all (atomic)
PATCH /recipes/{id}/ingredients/{itemId}
DELETE /recipes/{id}/ingredients/{itemId}
Same pattern for /instructions.
The atomic “replace all” endpoint is what the React admin uses when you save the Ingredients/Instructions tab — one round trip to write a whole grouped list.
Nutrition
1:1 with recipes:
GET /recipes/{id}/nutrition
PUT /recipes/{id}/nutrition # Upsert
DELETE /recipes/{id}/nutrition
Reviews
GET /reviews
GET /reviews/{id}
POST /reviews # Submit (public)
PATCH /reviews/{id} # Moderator edit (status, admin_reply, is_verified)
DELETE /reviews/{id}
POST /reviews/{id}/helpful # Vote helpful
DELETE /reviews/{id}/helpful # Retract vote
Collections & Shopping Lists
GET /collections
GET /collections/{id}
POST /collections
PATCH /collections/{id}
DELETE /collections/{id}
POST /collections/{id}/recipes # Add/remove/reorder (atomic)
GET /shopping-lists # Current user's lists
POST /shopping-lists
PATCH /shopping-lists/{id}
DELETE /shopping-lists/{id}
POST /shopping-lists/{id}/items
PATCH /shopping-lists/{id}/items/{itemId}
DELETE /shopping-lists/{id}/items/{itemId}
POST /shopping-lists/from-recipe/{recipeId} # Build list from a recipe
POST /shopping-lists/from-collection/{id} # Build list from a meal plan
Favorites
GET /favorites # Current user
POST /favorites # { recipe_id }
DELETE /favorites/{recipeId}
Views & Shortcodes
GET /views
GET /views/{id}
POST /views
PATCH /views/{id}
DELETE /views/{id}
GET /shortcodes
…
Custom Fields PRO
GET /custom-fields
POST /custom-fields
PATCH /custom-fields/{id}
DELETE /custom-fields/{id}
POST /custom-fields/ordering
AI Generator PRO
POST /ai/generate # { source_type: 'topic'|'url'|'document', input, count }
POST /ai/import # Accept the generated recipes
Import / Export PRO
POST /import-export/import # multipart/form-data with the file
GET /import-export/export # Streams JSON/CSV
SEO Analyzer PRO
POST /seo-analyzer/analyze/{recipeId}
GET /seo-analyzer/recipe/{recipeId}
POST /seo-analyzer/analyze-all # Site-wide
Settings
GET /settings
PATCH /settings # Merge partial update
Multilingual
GET /multilingual/languages
POST /multilingual/translate/{resource}/{id} # Create a linked translation
Response format
All list endpoints wrap results in a consistent envelope:
{
"data": [ … ],
"meta": {
"total": 241,
"page": 1,
"per_page": 20,
"pages": 13
}
}
Detail endpoints return { "data": { … } } or just the object directly (depends on endpoint — check the specific endpoint in class-*-controller.php).
Errors
Errors follow the WordPress WP_Error envelope:
{
"code": "plugixa_recipe_feature_gated",
"message": "This feature requires a Pro license.",
"data": {
"status": 402,
"upgrade_url": "https://…"
}
}
HTTP status codes:
| Code | Meaning |
|---|---|
| 200 | OK |
| 201 | Created |
| 204 | Deleted |
| 400 | Bad request (validation failure) |
| 401 | Not authenticated |
| 402 | Pro feature required |
| 403 | Not authorized (permission) |
| 404 | Not found |
| 422 | Business-rule violation |
| 500 | Server error |
Rate limiting
Anonymous read endpoints are rate-limited by IP. Configure the limit in Settings → API → Rate limit. Authenticated requests (nonce or app password) bypass the limit.
CORS
To expose the API to a different origin (e.g., a Next.js headless site), set Settings → API → CORS origin to your origin (or * for public read-only). The plugin injects the Access-Control-Allow-Origin header on API responses.
Example: build a JSON index
curl -s https://example.com/wp-json/plugixarecipe/v1/recipes?per_page=100 \
| jq '.data[] | {id, title, rating: .rating_average}'
Example: create a recipe
curl -X POST https://example.com/wp-json/plugixarecipe/v1/recipes \
-H "Content-Type: application/json" \
-u "user:AppPassword1234 AppPassword1234" \
-d '{
"title": "Simple omelette",
"status": "published",
"prep_time": 5,
"cook_time": 5,
"servings": 1,
"difficulty": "easy",
"ingredients": [
{ "name": "eggs", "quantity": "3", "unit": "" },
{ "name": "butter", "quantity": "1", "unit": "tbsp" }
],
"instructions": [
{ "instruction_text": "Beat the eggs." },
{ "instruction_text": "Melt butter in a pan, pour in eggs, fold, serve." }
]
}'
REST-first design
Every UI inside the React admin uses only the REST API — no direct PHP rendering of data. So anything the admin can do, your own integration can do too.