Contents
On this page

Update Cuisine - Plugixa Recipe

PUT /plugixa-recipe/v1/cuisines/{id}

Change the fields you send and leave the rest as they are.

Needs the plugixa_recipe_edit capability, or WordPress’s edit_posts (Contributor and up).

Note. A name that is sent empty is stored empty: only create checks that a name is there.

Request

PUT https://your-site.example/wp-json/plugixa-recipe/v1/cuisines/5

Path parameters

Name Type Description
id integer The cuisine’s id

Request body

Content type: application/json

Any field of Create Cuisine, none of them required. An empty slug is made again from the name. Send image_id as 0 to remove the image.

{
  "description": "Pasta, pizza and risotto."
}

Responses

200 OK. data is the updated cuisine.

{
  "success": true,
  "message": "",
  "data": {
    "id": "5",
    "name": "Italian",
    "slug": "italian",
    "description": "Pasta, pizza and risotto.",
    "image_id": null,
    "display_order": "0",
    "language_code": "",
    "translation_group": "",
    "recipe_count": 6
  }
}
Field Type Meaning
data.id string The cuisine’s id
data.slug string Unique among cuisines
data.description string|null Plain text
data.image_id string|null Attachment id. image_url is added when set
data.display_order string Manual position
data.recipe_count integer Recipes linked to it, in any status
data.language_code, data.translation_group string|null For multilingual sites

Errors

Status Code When
404 rest_error No cuisine with that id.
400 rest_error The body names none of the fields above.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-recipe/v1/cuisines/5" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"description":"Pasta, pizza and risotto."}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-recipe/v1/cuisines/5');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'description' => 'Pasta, pizza and risotto.',
    ]),
]);
$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/cuisines/5', {
  method: 'PUT',
  headers: {
    'Authorization': auth,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"description": "Pasta, pizza and risotto."}),
});
const { data } = await response.json();

Quick Links

Share