Contents
On this page

List Ingredients - Plugixa Recipe

GET /plugixa-recipe/v1/recipes/{id}/ingredients

Read a recipe’s ingredients in display order.

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/recipes/12/ingredients

Path parameters

Name Type Description
id integer The recipe’s id

Responses

200 OK. data is every ingredient of the recipe, by group, then position.

{
  "success": true,
  "message": "",
  "data": [
    {
      "id": "101",
      "recipe_id": "12",
      "group_name": "",
      "group_order": "0",
      "sort_order": "0",
      "quantity": "2",
      "unit": "cups",
      "name": "flour",
      "notes": "",
      "link_url": "",
      "amount": "2.000",
      "amount_max": null,
      "is_optional": "0",
      "substitution": ""
    },
    {
      "id": "102",
      "recipe_id": "12",
      "group_name": "",
      "group_order": "0",
      "sort_order": "1",
      "quantity": "1 1/2",
      "unit": "cups",
      "name": "milk",
      "notes": "",
      "link_url": "",
      "amount": "1.500",
      "amount_max": null,
      "is_optional": "0",
      "substitution": "oat milk"
    }
  ]
}
Field Type Meaning
data[].id string The row’s id. Rows get new ids on every replace
data[].group_name string Section heading, such as For the batter. Empty when ungrouped
data[].group_order, data[].sort_order string Position of the group, then of the row in it
data[].quantity string The quantity as typed
data[].amount, data[].amount_max string|null The quantity as numbers (three decimals), amount_max for a range. null when the text is not a number
data[].unit, data[].name, data[].notes string Unit, ingredient name and a note
data[].link_url string Optional link for the ingredient
data[].is_optional string 1 or 0
data[].substitution string Suggested swap

Errors

Status Code When
404 rest_error No recipe with that id.

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-recipe/v1/recipes/12/ingredients" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-recipe/v1/recipes/12/ingredients');
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 response = await fetch('https://your-site.example/wp-json/plugixa-recipe/v1/recipes/12/ingredients', {
  headers: {
    'Authorization': auth,
  },
});
const { data } = await response.json();

Quick Links

Share