Contents
On this page

List Cuisines - Plugixa Recipe

GET /plugixa-recipe/v1/cuisines

List cuisines with the number of recipes linked to each.

Needs a signed-in user who can open Plugixa Recipe: the plugixa_recipe_manage capability, or WordPress’s edit_posts (Contributor and up).

Request

GET https://your-site.example/wp-json/plugixa-recipe/v1/cuisines?orderby=name&order=ASC

Query parameters

Name Type Default Description
search string Matches the name or the description.
filter[language_code] string Only cuisines in this language.

Plus the list parameters every list accepts. orderby accepts name, display_order; anything else, the default included, sorts by display_order.

Responses

200 OK. data.items is one page of cuisines.

{
  "success": true,
  "message": "",
  "data": {
    "items": [
      {
        "id": "5",
        "name": "Italian",
        "slug": "italian",
        "description": "Dishes from Italy.",
        "image_id": null,
        "display_order": "0",
        "language_code": "",
        "translation_group": "",
        "recipe_count": 6
      }
    ],
    "total": 1,
    "limit": 20,
    "offset": 0
  }
}
Field Type Meaning
data.items[] object A cuisine, as in Get Cuisine
data.items[].recipe_count integer Recipes linked to it, in any status
data.total integer Cuisines matching the search, before paging

Errors

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-recipe/v1/cuisines?orderby=name&order=ASC" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$query = http_build_query([
    'orderby' => 'name',
    'order'   => 'ASC',
]);
$ch = curl_init('https://your-site.example/wp-json/plugixa-recipe/v1/cuisines?' . $query);
curl_setopt_array($ch, [
    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 query = new URLSearchParams({ orderby: 'name', order: 'ASC' });
const response = await fetch(`https://your-site.example/wp-json/plugixa-recipe/v1/cuisines?${query}`, {
  headers: {
    'Authorization': auth,
  },
});
const { data } = await response.json();

Quick Links

Share