Contents
On this page

List Instructions - Plugixa Recipe

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

Read a recipe’s instructions 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/instructions

Path parameters

Name Type Description
id integer The recipe’s id

Responses

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

{
  "success": true,
  "message": "",
  "data": [
    {
      "id": "201",
      "recipe_id": "12",
      "group_name": "",
      "group_order": "0",
      "sort_order": "0",
      "title": "",
      "instruction_text": "Whisk the flour, milk and lemon zest.",
      "image_id": null,
      "video_url": "",
      "duration": null,
      "timer_seconds": null,
      "tip": "",
      "text": "Whisk the flour, milk and lemon zest."
    },
    {
      "id": "202",
      "recipe_id": "12",
      "group_name": "",
      "group_order": "0",
      "sort_order": "1",
      "title": "",
      "instruction_text": "Cook each pancake for 2 minutes a side.",
      "image_id": null,
      "video_url": "",
      "duration": "4",
      "timer_seconds": "240",
      "tip": "",
      "text": "Cook each pancake for 2 minutes a side."
    }
  ]
}
Field Type Meaning
data[].id string The step’s id. Steps get new ids on every replace
data[].instruction_text string The step, HTML
data[].text string A copy of instruction_text
data[].title string Optional step title
data[].group_name string Section heading. Empty when ungrouped
data[].group_order, data[].sort_order string Position of the group, then of the step
data[].timer_seconds string|null Timer length in seconds
data[].duration string|null The same timer in whole minutes
data[].image_id string|null Step photo. image_url and image_thumbnail are added when set
data[].video_url, data[].tip string Optional video link and tip

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

Quick Links

Share