Contents
Delete Nutrition - Plugixa Recipe
DELETE /plugixa-recipe/v1/recipes/{id}/nutrition
Delete a recipe’s nutrition row, so its page shows no nutrition label.
Needs the plugixa_recipe_delete capability, or WordPress’s delete_published_posts (Author and up). The Nutrition app must be on.
Request
DELETE https://your-site.example/wp-json/plugixa-recipe/v1/recipes/12/nutrition
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The recipe’s id |
Responses
200 OK. The nutrition row is gone.
{
"success": true,
"message": "Nutrition data deleted.",
"data": null
}
Deleting from a recipe that has no nutrition row also answers 200.
Errors
| Status | Code | When |
|---|---|---|
404 |
rest_error |
No recipe with that id. |
Plus the errors every endpoint can return.
Examples
curl -s -X DELETE "https://your-site.example/wp-json/plugixa-recipe/v1/recipes/12/nutrition" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-recipe/v1/recipes/12/nutrition');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixa-recipe/v1/recipes/12/nutrition', {
method: 'DELETE',
headers: {
'Authorization': auth,
},
});
const { success } = await response.json();
Quick Links
Share