{"id":9372,"date":"2026-07-11T17:01:56","date_gmt":"2026-07-11T16:01:56","guid":{"rendered":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/?post_type=wz_knowledgebase&#038;p=9372"},"modified":"2026-07-11T17:01:56","modified_gmt":"2026-07-11T16:01:56","slug":"knowledge-base-rest-api","status":"publish","type":"wz_knowledgebase","link":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/support\/knowledgebase\/knowledge-base-rest-api\/","title":{"rendered":"Knowledge Base REST API"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/plugins\/knowledgebase\/\" data-type=\"page\" data-id=\"34\">WebberZone Knowledge Base<\/a> plugin exposes selected functionality via the WordPress REST API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All endpoints live under the namespace <code>wzkb\/v1<\/code> and therefore share the base path:<\/p>\n\n\n\n<pre class=\"wp-block-code language-none\"><code lang=\"text\" class=\"language-none\">https:\/\/round-lake.dustinice.workers.dev:443\/https\/example.com\/wp-json\/wzkb\/v1\/<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Replace <code>https:\/\/round-lake.dustinice.workers.dev:443\/https\/example.com<\/code> with your site\u2019s domain.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Authentication &amp; Permissions<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The API piggybacks on WordPress capabilities. Standard WordPress authentication mechanisms (cookies for logged-in sessions, app passwords, basic auth plugins, etc.) all work.<\/li>\n\n\n\n<li>All REST responses follow standard WordPress structures with <code>code<\/code>, <code>message<\/code>, and <code>data<\/code>.<\/li>\n\n\n\n<li>Cache lifetime is 300 seconds. Cache busts automatically on KB content or taxonomy changes.<\/li>\n\n\n\n<li>When used in a headless context, ensure Gutenberg meta <code>_wzkb_product_ids<\/code> and <code>_wzkb_section_ids<\/code> are synced.<\/li>\n\n\n\n<li>Permissions can be customized per route via the <code>wzkb_rest_route_permission<\/code> filter.<\/li>\n\n\n\n<li>By default, all read-only routes are public. Use the permission filter below to restrict access.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Permission overrides<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Developers can override route-level visibility without replacing the controller. The filter receives the route slug and the default public flag (<code>true<\/code> for read endpoints).<\/p>\n\n\n\n<pre class=\"wp-block-code language-php\"><code lang=\"php\" class=\"language-php\">add_filter(\n    'wzkb_rest_route_permission',\n    static function ( $permission, $route_slug, $is_public ) {\n        if ( 'search' === $route_slug ) {\n            \/\/ Require logged-in users with the custom capability.\n            return 'read_private_kb';\n        }\n\n        \/\/ Fall back to default behaviour.\n        return $permission;\n    },\n    10,\n    3\n);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Return values:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>bool<\/code> \u2013 grant\/deny outright.<\/li>\n\n\n\n<li><code>string<\/code> \u2013 capability checked via <code>current_user_can()<\/code>.<\/li>\n\n\n\n<li><code>callable<\/code> \u2013 custom logic returning boolean.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Multi-product prerequisite<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Several endpoints (starting with Sections) are only available when <strong>multi-product mode<\/strong> is enabled inside Knowledge Base Pro (<code>Knowledge Base \u25b8 Settings \u25b8 General \u25b8 Enable multi-product<\/code>). If disabled, the endpoint will return a <code>wzkb_rest_sections_disabled<\/code> error.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Endpoints<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#get-wzkbv1sections\">GET <code>\/wzkb\/v1\/sections<\/code><\/a><\/li>\n\n\n\n<li><a href=\"#get-wzkbv1knowledgebase\">GET <code>\/wzkb\/v1\/knowledgebase<\/code><\/a><\/li>\n\n\n\n<li><a href=\"#get-wzkbv1knowledgebaseid\">GET <code>\/wzkb\/v1\/knowledgebase\/{id}<\/code><\/a><\/li>\n\n\n\n<li><a href=\"#get-wzkbv1products\">GET <code>\/wzkb\/v1\/products<\/code><\/a><\/li>\n\n\n\n<li><a href=\"#get-wzkbv1search\">GET <code>\/wzkb\/v1\/search<\/code><\/a><\/li>\n\n\n\n<li><a href=\"#get-wzkbv1related\">GET <code>\/wzkb\/v1\/related<\/code><\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">GET <code>\/wzkb\/v1\/sections<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Fetches Knowledge Base sections (<code>wzkb_category<\/code> terms) filtered by one or more product IDs, preserving parent\/child relationships for hierarchical rendering.<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>products<\/code><\/td>\n<td>string<\/td>\n<td>yes<\/td>\n<td>Comma-separated list of <code>wzkb_product<\/code> term IDs. Example: <code>173,178<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Request example<\/h4>\n\n\n\n<pre class=\"wp-block-code language-none\"><code lang=\"text\" class=\"language-none\">GET https:\/\/round-lake.dustinice.workers.dev:443\/https\/example.com\/wp-json\/wzkb\/v1\/sections?products=173,178<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Successful response<\/h4>\n\n\n\n<pre class=\"wp-block-code language-none\"><code lang=\"text\" class=\"language-none\">[[\n  {\n    \"id\": 201,\n    \"name\": \"Advanced\",\n    \"parent\": 0,\n    \"product\": 173\n  },\n  {\n    \"id\": 202,\n    \"name\": \"More advanced\",\n    \"parent\": 201,\n    \"product\": 173\n  },\n  {\n    \"id\": 310,\n    \"name\": \"Getting Started\",\n    \"parent\": 0,\n    \"product\": 178\n  }\n]]<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>id<\/code>: Section term ID.<\/li>\n\n\n\n<li><code>name<\/code>: Section name.<\/li>\n\n\n\n<li><code>parent<\/code>: Parent term ID (0 when top-level).<\/li>\n\n\n\n<li><code>product<\/code>: Associated product ID pulled from <code>product_id<\/code> term meta (0 when unassigned).<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Error responses<\/h4>\n\n\n\n<figure class=\"wp-block-table\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th>HTTP Code<\/th>\n<th>Error code<\/th>\n<th>Reason<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>400<\/td>\n<td><code>wzkb_rest_sections_disabled<\/code><\/td>\n<td>Multi-product mode is disabled.<\/td>\n<\/tr>\n<tr>\n<td>401 \/ 403<\/td>\n<td><code>rest_forbidden<\/code><\/td>\n<td>User lacks the capability granted via the <code>wzkb_rest_route_permission<\/code> filter.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">GET <code>\/wzkb\/v1\/knowledgebase<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">List published Knowledge Base posts with optional filtering.<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>per_page<\/code><\/td>\n<td>int<\/td>\n<td>no<\/td>\n<td>Results per page (1\u201350). Default: 10.<\/td>\n<\/tr>\n<tr>\n<td><code>page<\/code><\/td>\n<td>int<\/td>\n<td>no<\/td>\n<td>Page number. Default: 1.<\/td>\n<\/tr>\n<tr>\n<td><code>search<\/code><\/td>\n<td>string<\/td>\n<td>no<\/td>\n<td>Free-text search term.<\/td>\n<\/tr>\n<tr>\n<td><code>product<\/code><\/td>\n<td>int<\/td>\n<td>no<\/td>\n<td>Filter by <code>wzkb_product<\/code> term ID.<\/td>\n<\/tr>\n<tr>\n<td><code>section<\/code><\/td>\n<td>int<\/td>\n<td>no<\/td>\n<td>Filter by <code>wzkb_category<\/code> term ID.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Response<\/h4>\n\n\n\n<pre class=\"wp-block-code language-none\"><code lang=\"text\" class=\"language-none\">[\n  {\n    \"id\": 123,\n    \"title\": \"How to configure caching\",\n    \"slug\": \"configure-caching\",\n    \"excerpt\": \"Configure caching in three easy steps\u2026\",\n    \"permalink\": \"https:\/\/round-lake.dustinice.workers.dev:443\/https\/example.com\/kb\/configure-caching\/\",\n    \"products\": [[{ \"id\": 5, \"name\": \"Pro\", \"slug\": \"pro\" }]],\n    \"sections\": [[{ \"id\": 18, \"name\": \"Setup\", \"slug\": \"setup\" }]],\n    \"date\": \"2025-10-21T09:30:00\",\n    \"modified\": \"2025-10-23T14:05:00\"\n  }\n]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Headers: <code>X-WP-Total<\/code> (total posts) and <code>X-WP-TotalPages<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">GET <code>\/wzkb\/v1\/knowledgebase\/{id}<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Return a single Knowledge Base post including full content when published.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">GET <code>\/wzkb\/v1\/products<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">List all Knowledge Base products.<\/p>\n\n\n\n<pre class=\"wp-block-code language-none\"><code lang=\"text\" class=\"language-none\">[[\n  {\n    \"id\": 5,\n    \"name\": \"Contextual Related Posts\",\n    \"slug\": \"contextual-related-posts\",\n    \"description\": \"CRP-specific documentation.\",\n    \"count\": 34\n  }\n]]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">GET <code>\/wzkb\/v1\/search<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Lightweight search endpoint wrapping Knowledge Base queries.<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>query<\/code><\/td>\n<td>string<\/td>\n<td>yes<\/td>\n<td>Search keywords (min 2 characters).<\/td>\n<\/tr>\n<tr>\n<td><code>product<\/code><\/td>\n<td>int<\/td>\n<td>no<\/td>\n<td>Filter by product term ID.<\/td>\n<\/tr>\n<tr>\n<td><code>section<\/code><\/td>\n<td>int<\/td>\n<td>no<\/td>\n<td>Filter by section term ID.<\/td>\n<\/tr>\n<tr>\n<td><code>limit<\/code><\/td>\n<td>int<\/td>\n<td>no<\/td>\n<td>Results to return (1\u201350). Default: 10.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">GET <code>\/wzkb\/v1\/related<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Fetch related articles for a given Knowledge Base post.<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>post_id<\/code><\/td>\n<td>int<\/td>\n<td>yes<\/td>\n<td>Base Knowledge Base post ID.<\/td>\n<\/tr>\n<tr>\n<td><code>limit<\/code><\/td>\n<td>int<\/td>\n<td>no<\/td>\n<td>Number of related items (1\u201320).<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Using the API in Gutenberg<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The custom Gutenberg panel (<code>includes\/admin\/js\/editor-sections-panel.js<\/code>) consumes <code>\/sections<\/code> to show product-aware section lists. Other clients (mobile apps, headless front ends, internal tools) can consume the same endpoint, provided they authenticate and the site is running in multi-product mode.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Support<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The above REST API is a preliminary implementation. If you notice any issue, have any usage questions or to suggest additional endpoints, please <a href=\"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/request-support\/\" data-type=\"page\" data-id=\"7861\">open a ticket<\/a>.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>The WebberZone Knowledge Base plugin exposes selected functionality via the WordPress REST API. All endpoints live under the namespace wzkb\/v1 and therefore share the base path: Replace https:\/\/round-lake.dustinice.workers.dev:443\/https\/example.com with your site\u2019s domain. Authentication &amp; Permissions Permission overrides Developers can override route-level visibility without replacing the controller. The filter receives the route slug and the default&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_wp_convertkit_post_meta":{"form":"-1","landing_page":"","tag":"0","restrict_content":"0"},"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_wzkb_product_ids":[142],"_wzkb_section_ids":[84],"footnotes":""},"wzkb_product":[142],"wzkb_category":[84],"wzkb_tag":[63,121],"class_list":["post-9372","wz_knowledgebase","type-wz_knowledgebase","status-publish","hentry","wzkb_product-knowledgebase","wzkb_category-03-kb-developer-docs","wzkb_tag-knowledgebase","wzkb_tag-rest-api"],"_links":{"self":[{"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/wz_knowledgebase\/9372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/wz_knowledgebase"}],"about":[{"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/types\/wz_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/comments?post=9372"}],"version-history":[{"count":5,"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/wz_knowledgebase\/9372\/revisions"}],"predecessor-version":[{"id":10151,"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/wz_knowledgebase\/9372\/revisions\/10151"}],"wp:attachment":[{"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/media?parent=9372"}],"wp:term":[{"taxonomy":"wzkb_product","embeddable":true,"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/wzkb_product?post=9372"},{"taxonomy":"wzkb_category","embeddable":true,"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/wzkb_category?post=9372"},{"taxonomy":"wzkb_tag","embeddable":true,"href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/webberzone.com\/wp-json\/wp\/v2\/wzkb_tag?post=9372"}],"curies":[{"name":"wp","href":"https:\/\/round-lake.dustinice.workers.dev:443\/https\/api.w.org\/{rel}","templated":true}]}}