REST API User Manual

Artemis Herbal Remedies Database — REST API Guide

Base URL: https://herbs.artemis-temple.com/wp-json

This API is powered by the WordPress REST API. The Monographs custom post type is artm_monograph. All herb-related taxonomies are exposed under wp/v2/{taxonomy} (e.g., artm_system, artm_action, etc.).


1) API Discovery

API index

GET /

GET https://herbs.artemis-temple.com/wp-json/

Returns namespaces and routes (including wp/v2).

Types & taxonomies

GET https://herbs.artemis-temple.com/wp-json/wp/v2/types/artm_monograph
GET https://herbs.artemis-temple.com/wp-json/wp/v2/taxonomies

2) Monographs

List monographs

GET /wp/v2/artm_monograph

GET https://herbs.artemis-temple.com/wp-json/wp/v2/artm_monograph?per_page=10&page=1&_embed&_fields=id,slug,title,link,meta

Response (truncated):

[
  {
    "id": 1234,
    "slug": "moringa-oleifera",
    "link": "https://herbs.artemis-temple.com/monographs/moringa-oleifera/",
    "title": {"rendered": "Moringa oleifera"},
    "meta": {
      "artm_summary": "<p>Short readable summary…</p>",
      "artm_planet": ["Sun"],
      "artm_element": ["Fire"]
    },
    "_embedded": {
      "wp:term": [
        [ /* artm_system terms */ ],
        [ /* artm_action terms */ ]
      ]
    }
  }
]

Tips

  • per_page (1–100), page (pagination).
  • _embed includes linked resources (taxonomies, media).
  • _fields limits payload for performance.

Get one monograph

GET /wp/v2/artm_monograph/{id}

GET https://herbs.artemis-temple.com/wp-json/wp/v2/artm_monograph/1234?_embed

Search by keyword

GET https://herbs.artemis-temple.com/wp-json/wp/v2/artm_monograph?search=ginger

Order & sort

GET https://herbs.artemis-temple.com/wp-json/wp/v2/artm_monograph?orderby=title&order=asc

Filter by taxonomy

You can filter artm_monograph by passing taxonomy query args. Most setups support term ID, slug, or array style:

# Single taxonomy, by slug
GET /wp-json/wp/v2/artm_monograph?artm_system=digestive

# Single taxonomy, multiple slugs
GET /wp-json/wp/v2/artm_monograph?artm_action[]=carminative&artm_action[]=nervine

# Using term IDs
GET /wp-json/wp/v2/artm_monograph?artm_system=34

# Multiple taxonomies at once
GET /wp-json/wp/v2/artm_monograph?artm_system=digestive&artm_action=carminative

If you don’t see results, try using term IDs. (Exact filter mechanics depend on how the site registers taxonomies; both slugs and IDs are commonly supported.)

Filter by meta (if exposed)

If specific fields were registered via register_post_meta(... 'show_in_rest' => true), you may filter with meta_* query vars:

GET /wp-json/wp/v2/artm_monograph?meta_key=artm_temperature&meta_value=Cooling

3) Taxonomies & Terms

Common taxonomy slugs (examples):

  • artm_family, artm_region, artm_part_used
  • artm_system, artm_action, artm_taste
  • artm_moisture, artm_temperature, artm_directionality, artm_tonicity
  • artm_planet, artm_element
  • artm_common_name, artm_constituent, artm_contraindication, artm_interaction, artm_dosage_prep
  • artm_indication_symptom, artm_indication_syndrome

List all terms of a taxonomy

GET /wp/v2/{taxonomy}

GET https://herbs.artemis-temple.com/wp-json/wp/v2/artm_system?per_page=100&orderby=name&order=asc

Response (truncated):

[
  { "id": 34, "name": "Digestive", "slug": "digestive", "count": 58 },
  { "id": 51, "name": "Nervous",   "slug": "nervous",   "count": 42 }
]

Get a single term

GET /wp/v2/{taxonomy}/{id}

GET https://herbs.artemis-temple.com/wp-json/wp/v2/artm_action/77

Search terms

GET https://herbs.artemis-temple.com/wp-json/wp/v2/artm_action?search=carminative

4) Practical Examples

A) “Show all Cooling, Dry herbs for the Digestive system”

GET /wp-json/wp/v2/artm_monograph
  ?artm_system=digestive
  &artm_moisture=dry
  &artm_temperature=cooling
  &_fields=id,slug,title,link

B) “Get a monograph with all its terms in one call”

GET /wp-json/wp/v2/artm_monograph?search=chamomile&_embed

C) “Browse all Actions terms with counts”

GET /wp-json/wp/v2/artm_action?per_page=100&orderby=count&order=desc

5) PHP Usage

Option 1: Inside WordPress (themes/plugins) — wp_remote_get()

<?php
$url = 'https://herbs.artemis-temple.com/wp-json/wp/v2/artm_monograph?per_page=20&_fields=id,slug,title,link';
$res = wp_remote_get($url);

if (is_wp_error($res)) {
    error_log('API error: ' . $res->get_error_message());
    return;
}

$code = wp_remote_retrieve_response_code($res);
$body = wp_remote_retrieve_body($res);
$data = json_decode($body, true);

if ($code !== 200 || !is_array($data)) {
    error_log('API bad response: ' . $body);
    return;
}

foreach ($data as $monograph) {
    printf(
        '<li><a href="%s">%s</a></li>',
        esc_url($monograph['link']),
        esc_html($monograph['title']['rendered'])
    );
}

Filter by taxonomy (multiple):

$args = [
    'artm_system' => 'digestive',
    'artm_action' => ['carminative', 'bitter']
];
$query = http_build_query($args);
$url = "https://herbs.artemis-temple.com/wp-json/wp/v2/artm_monograph?$query&_fields=id,slug,title,link";

$res = wp_remote_get($url);
$data = json_decode(wp_remote_retrieve_body($res), true);

Get terms:

$terms_url = 'https://herbs.artemis-temple.com/wp-json/wp/v2/artm_action?per_page=100';
$terms = json_decode(wp_remote_retrieve_body(wp_remote_get($terms_url)), true);

Option 2: Plain PHP (outside WordPress) — cURL

<?php
$ch = curl_init('https://herbs.artemis-temple.com/wp-json/wp/v2/artm_monograph?per_page=5&_fields=id,slug,title,link');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_USERAGENT => 'Artemis-Client/1.0'
]);
$body = curl_exec($ch);
if ($body === false) {
    die('cURL error: ' . curl_error($ch));
}
$code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

if ($code !== 200) {
    die("HTTP $code: $body");
}
$data = json_decode($body, true);
foreach ($data as $row) {
    echo $row['title']['rendered'] . ' — ' . $row['link'] . PHP_EOL;
}

Filter by terms (array-style):

$params = [
  'artm_system' => 'nervous',
  'artm_action' => ['nervine','anxiolytic'],
  '_fields'     => 'id,slug,title,link'
];
$url = 'https://herbs.artemis-temple.com/wp-json/wp/v2/artm_monograph?' . http_build_query($params);

6) Status, Errors, and Headers

  • Success: HTTP 200 (list/get), 201 (create; if authenticated), 204 (delete; if authenticated).
  • Errors: JSON object with code, message, data (e.g., rest_post_invalid_id, rest_forbidden).
  • Pagination: response headers X-WP-Total, X-WP-TotalPages.
  • CORS: Public GET requests are typically allowed; write endpoints require auth and nonce.

7) Performance Tips

  • Use _fields to trim responses.
  • Use _embed only when you need linked resources.
  • Cache responses (transients or object cache) on your server.
  • Prefer term IDs for filters if you see inconsistencies with slugs.

8) Quick Reference (Common Routes)

  • Monographs
    • GET /wp/v2/artm_monograph
    • GET /wp/v2/artm_monograph/{id}
  • Taxonomies
    • GET /wp/v2/taxonomies
    • GET /wp/v2/{taxonomy}
    • GET /wp/v2/{taxonomy}/{id}

Replace {taxonomy} with one of:
artm_family, artm_region, artm_part_used, artm_system, artm_action, artm_taste, artm_moisture, artm_temperature, artm_directionality, artm_tonicity, artm_planet, artm_element, artm_common_name, artm_qi_blood_fluid, artm_constituent, artm_contraindication, artm_interaction, artm_dosage_prep, artm_indication_symptom, artm_indication_syndrome.