Contents
On this page

Get Course - Plugixa Recipe

GET /plugixa-recipe/v1/courses/{id}

Read one course with its recipe count.

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/courses/8

Path parameters

Name Type Description
id integer The course’s id

Responses

200 OK. data is the course.

{
  "success": true,
  "message": "",
  "data": {
    "id": "8",
    "name": "Breakfast",
    "slug": "breakfast",
    "description": "",
    "display_order": "7",
    "recipe_count": 6
  }
}
Field Type Meaning
data.id string The course’s id
data.slug string Unique among courses
data.description string|null Plain text
data.display_order string Manual position
data.recipe_count integer Recipes linked to it, in any status

Errors

Status Code When
404 rest_error No course with that id.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share