Contents
On this page
Remove Recipe from Collection - Plugixa Recipe
DELETE /plugixa-recipe/v1/collections/{id}/recipes/{recipe_id}
Take a recipe out of a collection. The recipe itself is kept.
Needs the plugixa_recipe_edit capability, or WordPress’s edit_posts (Contributor and up). Needs Plugixa Recipe Pro with the Collections app on.
Note. In a meal plan this removes the recipe from every day and meal it is on, not one entry.
Request
DELETE https://your-site.example/wp-json/plugixa-recipe/v1/collections/4/recipes/12
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The collection’s id |
recipe_id |
integer |
The recipe’s id |
Responses
200 OK. The recipe is out of the collection.
{
"success": true,
"message": "Recipe removed from collection.",
"data": null
}
Errors
| Status | Code | When |
|---|---|---|
404 |
rest_error |
The recipe is not in that collection, or there is no such collection. |
Plus the errors every endpoint can return.
Examples
curl -s -X DELETE "https://your-site.example/wp-json/plugixa-recipe/v1/collections/4/recipes/12" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-recipe/v1/collections/4/recipes/12');
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/collections/4/recipes/12', {
method: 'DELETE',
headers: {
'Authorization': auth,
},
});
const { success } = await response.json();
Quick Links
Share