{"id":1779,"date":"2024-09-26T13:44:50","date_gmt":"2024-09-26T13:44:50","guid":{"rendered":"http:\/\/docs"},"modified":"2024-09-26T13:44:50","modified_gmt":"2024-09-26T13:44:50","password":"","slug":"xstore-brands-api","status":"publish","type":"docs","link":"https:\/\/www.8theme.com\/documentation\/xstore\/xstore-hooks-filters\/xstore-brands-api\/","title":{"rendered":"XStore Brands API"},"content":{"rendered":"<h3>Brands (eteheme_brands)<\/h3>\n<p>The schema defines all the fields that exist within a brand record. Any response from these endpoints can be expected to contain the fields below unless the <code class=\"inline-code\">_filter<\/code> query parameter is used or the schema field only appears in a specific context.<\/p>\n<h3>Schema<\/h3>\n<table style=\"border: 1px solid #f0f0f0;\">\n<tbody>\n<tr>\n<td>\n\t\t<strong>id<\/strong> <br \/>\n\t\t(integer)\n\t<\/td>\n<td>\n\t\tUnique identifier for the term.<br \/>\n\t\t<br \/>\n\t\tRead-only<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, embed, edit<\/strong>\n\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t<strong>count<\/strong> <br \/>\n\t\t(integer)\n\t<\/td>\n<td>\n\t\tThe number of published posts for the term.<br \/>\n\t\t<br \/>\n\t\tRead-only<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, edit<\/strong>\n\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t<strong>description<\/strong><br \/>\n\t\t(string)\n\t<\/td>\n<td>\n\t\tHTML description of the term.<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, edit<\/strong>\n\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t<strong>link<\/strong> <br \/>\n\t\t(string, URI)\n\t<\/td>\n<td>\n\t\tURL of the term.<br \/>\n\t\t<br \/>\n\t\tRead-only<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, embed, edit<\/strong>\n\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t<strong>name<\/strong> <br \/>\n\t\t(string)&nbsp;\n\t<\/td>\n<td>\n\t\tHTML title for the term.<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, embed, edit<\/strong>\n\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t<strong>slug<\/strong> <br \/>\n\t\t(string)&nbsp;\n\t<\/td>\n<td>\n\t\tAn alphanumeric identifier for the term unique to its type.<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, embed, edit<\/strong>\n\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t<strong>taxonomy<\/strong> <br \/>\n\t\t(string)\n\t<\/td>\n<td>\n\t\tType attribution for the term.<br \/>\n\t\t<br \/>\n\t\tRead-only<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, embed, edit<\/strong><br \/>\n\t\tOne of: category, post_tag, nav_menu, link_category, post_format<br \/>\n\t\t\n\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t<strong>parent<\/strong> <br \/>\n\t\t(integer)\n\t<\/td>\n<td>\n\t\tThe parent term ID.<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, edit<\/strong>\n\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t<strong>meta<\/strong><br \/>\n\t\t(object, array)\n\t<\/td>\n<td>\n\t\tMeta fields.<br \/>\n\t\t<br \/>\n\t\tContext:<br \/>\n\t\t<strong>view, edit<\/strong>\n\t<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>List Brands<\/h3>\n<p>Query this endpoint to retrieve a collection of brands. The response you receive can be controlled and filtered using the URL query parameters below.<\/p>\n<h4>Definition\u00a0<\/h4>\n<pre>GET \/wp\/v2\/etheme_brands\n<\/pre>\n<h4>Example Request<\/h4>\n<pre>$ curl &lt;a href=&quot;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands&quot;&gt;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands&lt;\/a&gt;\n<\/pre>\n<h4>Example URL<\/h4>\n<div><code class=\"inline-code\">https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands<\/code><\/div>\n<h4>Arguments\u00a0<\/h4>\n<table>\n<tbody>\n<tr>\n<td><strong>context<\/strong><\/td>\n<td>\n<p>The scope under which the request is made; determines the fields present in the response.<\/p>\n<p>Default: view<\/p>\n<p>One of: <strong>view, embed, edit<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><strong>page<\/strong><\/td>\n<td>\n<p>Current page of the collection.<\/p>\n<p>Default: <strong>1<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><strong>per_page<\/strong><\/td>\n<td>\n<p>Maximum number of items to be returned in result set.<\/p>\n<p>Default: <strong>10<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><strong>search<\/strong><\/td>\n<td>Limit results to those matching a string.<\/td>\n<\/tr>\n<tr>\n<td><strong>exclude<\/strong><\/td>\n<td>Ensure the result set excludes specific IDs.<\/td>\n<\/tr>\n<tr>\n<td><strong>include<\/strong><\/td>\n<td>Limit result set to specific IDs.<\/td>\n<\/tr>\n<tr>\n<td><strong>order<\/strong><\/td>\n<td>\n<p>Order sort attribute ascending or descending.<\/p>\n<p>Default: <strong>asc<\/strong><\/p>\n<p>One of: <strong>asc, desc<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><strong>orderby<\/strong><\/td>\n<td>\n<p>Sort collection by term attribute.<\/p>\n<p>Default: <strong>name<\/strong><\/p>\n<p>One of: <strong>id, include, name, slug, include_slugs, term_group, description, count<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><strong>hide_empty<\/strong><\/td>\n<td>Whether to hide terms not assigned to any posts.<\/td>\n<\/tr>\n<tr>\n<td><strong>parent<\/strong><\/td>\n<td>Limit result set to terms assigned to a specific parent.<\/td>\n<\/tr>\n<tr>\n<td><strong>post<\/strong><\/td>\n<td>Limit results set to terms assigned to a specific post.<\/td>\n<\/tr>\n<tr>\n<td><strong>slug<\/strong><\/td>\n<td>Limit results set to terms with one or more specific slugs.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Create a Brand<\/h3>\n<h4>Definition<\/h4>\n<pre>POST \/wp\/v2\/etheme_brands\n<\/pre>\n<h4>Example Request from curl (in progress)<\/h4>\n<pre>$ curl &lt;a href=&quot;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands&quot;&gt;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands&lt;\/a&gt;\n<\/pre>\n<h4>Example Request from wp<\/h4>\n<pre>$meta = (object) array(\n\t&#39;some_meta&#39; =&gt; &#39;value&#39;\n);\n$image = array(\n\t&#39;src&#39;         =&gt; &#39;https:\/\/example.com\/woocommerce\/wp-content\/uploads\/sites\/56\/2013\/06\/T_2_back.jpg&#39;,\n\t&#39;alt&#39;         =&gt; &#39;some alt&#39;,\n    &#39;title&#39;       =&gt; &#39;some title&#39;,\n    &#39;caption&#39;     =&gt; &#39;some caption&#39;,\n    &#39;description&#39; =&gt; &#39;some description&#39;\n);\n$api_response = wp_remote_post( &#39;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands&#39;, array(\n\t&#39;headers&#39; =&gt; array(\n\t\t&#39;Authorization&#39; =&gt; &#39;Basic &#39; . base64_encode( &#39;user_name:user_password&#39; )\n\t),\n\t&#39;body&#39; =&gt; array(\n\t\t&#39;name&#39;        =&gt; &#39;example brand&#39;,\n        &#39;slug&#39;        =&gt; &#39;example-brand&#39;,\n        &#39;description&#39; =&gt; &#39;some description&#39;,\n        &#39;meta&#39;        =&gt; $meta,\n        &#39;image&#39;       =&gt; $image\n\t)\n) );\n<\/pre>\n<h3>Arguments<\/h3>\n<table>\n<tbody>\n<tr>\n<td>\n<p><strong>description<\/strong><\/p>\n<p>(string)<\/p>\n<\/td>\n<td>HTML description of the Brand.<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>name<\/strong> <\/p>\n<p>(string)<\/p>\n<\/td>\n<td>\n<p>HTML title for the term.<\/p>\n<p>Required: 1(true)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>slug<\/strong> <\/p>\n<p>(string)<\/p>\n<\/td>\n<td>An alphanumeric identifier for the term unique to its type.<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>parent<\/strong> <\/p>\n<p>(integer)<\/p>\n<\/td>\n<td>The parent term ID.<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>meta<\/strong> <\/p>\n<p>(array, object)<\/p>\n<\/td>\n<td>Meta fields.<\/td>\n<\/tr>\n<tr>\n<td>\n<p><strong>image<\/strong> <\/p>\n<p>(array, object)<\/p>\n<\/td>\n<td>\n<p>image data for brand<\/p>\n<p><strong>src<\/strong> (string); Required: 1(true)<\/p>\n<p><strong>alt<\/strong> (string)<\/p>\n<p><strong>title<\/strong> (string)<\/p>\n<p><strong>caption<\/strong> (string)<\/p>\n<p><strong>description<\/strong> (string)<\/p>\n<p>Example array:<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre>$image = array(\n\t&#39;src&#39;         =&gt; &#39;https:\/\/example.com\/wp-content\/uploads\/sites\/56\/2013\/06\/T_2_back.jpg&#39;,\n\t&#39;alt&#39;         =&gt; &#39;alt text&#39;,\n\t&#39;title&#39;       =&gt; &#39;title text&#39;,\n\t&#39;caption&#39;     =&gt; &#39;caption &#39;,\n\t&#39;description&#39; =&gt; &#39;description&#39;\n);\n<\/pre>\n<h3>Retrieve a Brand<\/h3>\n<h4>Definition &amp; Example Request<\/h4>\n<pre>GET \/wp\/v2\/etheme_brands\/{brand_id}\n<\/pre>\n<h4>Example Request<\/h4>\n<pre>$ curl &lt;a href=&quot;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands{brand_id}&quot;&gt;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands{brand_id}&lt;\/a&gt;\n<\/pre>\n<h4>Example URL<\/h4>\n<div><code class=\"inline-code\">https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands{brand_id}<\/code><\/div>\n<h3>Arguments\u00a0<\/h3>\n<table>\n<tbody>\n<tr>\n<td><strong>id<\/strong><\/td>\n<td>Unique identifier for the term.<\/td>\n<\/tr>\n<tr>\n<td><strong>context<\/strong><\/td>\n<td>\n<p>Scope under which the request is made; determines the fields present in the response.<\/p>\n<p>Default: <strong>view<\/strong><\/p>\n<p>One of: <strong>view, embed, edit<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Update a Brand<\/h3>\n<h4>Definition<\/h4>\n<pre>POST \/wp\/v2\/etheme_brands\/id\n<\/pre>\n<h4>Example Request from curl (in progress)<\/h4>\n<pre>$ curl &lt;a href=&quot;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands\/id&quot;&gt;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands\/id&lt;\/a&gt;\n<\/pre>\n<h4>Example Request from WP<\/h4>\n<pre>$meta = (object) array(\n\t&#39;some_meta&#39; =&gt; &#39;value&#39;\n);\n\n$image = array(\n\t&#39;src&#39;         =&gt; &#39;https:\/\/example.com\/wp-content\/uploads\/sites\/56\/2013\/06\/T_2_back.jpg&#39;,\n\t&#39;alt&#39;         =&gt; &#39;some alt&#39;,\n    &#39;title&#39;       =&gt; &#39;some title&#39;,\n    &#39;caption&#39;     =&gt; &#39;some caption&#39;,\n    &#39;description&#39; =&gt; &#39;some description&#39;\n);\n\n$api_response = wp_remote_post( &#39;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands\/id&#39;, array(\n\t&#39;headers&#39; =&gt; array(\n\t\t&#39;Authorization&#39; =&gt; &#39;Basic &#39; . base64_encode( &#39;user_name:user_password&#39; )\n\t),\n\t&#39;body&#39; =&gt; array(\n\t\t&#39;name&#39;        =&gt; &#39;new example brand&#39;,\n        &#39;slug&#39;        =&gt; &#39;new-example-brand&#39;,\n        &#39;description&#39; =&gt; &#39;new some description&#39;,\n        &#39;meta&#39;        =&gt; $meta,\n        &#39;image&#39;       =&gt; $image\n\t)\n) );\n<\/pre>\n<p>To prevent uploading and setup the same image just remove the image param. If you want to change the image that already exists modify mata param:<\/p>\n<pre>$meta = (object) array(\n\t&#39;thumbnail_id&#39; =&gt; 5054, \/\/ ID of image in media library\n);\n<\/pre>\n<h3>Arguments\u00a0<\/h3>\n<table>\n<tbody>\n<tr>\n<td><strong>id<\/strong><\/td>\n<td>Unique identifier for the term.<\/td>\n<\/tr>\n<tr>\n<td><strong>description<\/strong><\/td>\n<td>HTML description of the term.<\/td>\n<\/tr>\n<tr>\n<td><strong>name<\/strong><\/td>\n<td>HTML title for the term.<\/td>\n<\/tr>\n<tr>\n<td><strong>slug<\/strong><\/td>\n<td>An alphanumeric identifier for the term unique to its type.<\/td>\n<\/tr>\n<tr>\n<td><strong>parent<\/strong><\/td>\n<td>The parent term ID.<\/td>\n<\/tr>\n<tr>\n<td><strong>meta<\/strong><\/td>\n<td>Meta fields.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Delete a Brand<\/h3>\n<h4>Definition\u00a0<\/h4>\n<pre>POST DELETE \/wp\/v2\/etheme_brands\/id\n<\/pre>\n<h4>Example Request<\/h4>\n<pre>$ curl -X\u00a0 DELETEhttps:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands\/id\n<\/pre>\n<h4>Example Request from WP<\/h4>\n<pre>$api_response = wp_remote_post( &#39;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands\/id&#39;, array(\n\t&#39;method&#39;    =&gt; &#39;DELETE&#39;,\n\t&#39;headers&#39; =&gt; array(\n\t\t&#39;Authorization&#39; =&gt; &#39;Basic &#39; . base64_encode( &#39;user_name:user_password&#39; )\n\t),\n\t&#39;body&#39; =&gt; array(\n        &#39;force&#39; =&gt; true,\n\t)\n) );\n<\/pre>\n<p>or<\/p>\n<pre>$api_response = wp_remote_post( &#39;https:\/\/example.com\/wp-json\/wp\/v2\/etheme_brands\/id?force=true&#39;, array(\n\t&#39;method&#39;    =&gt; &#39;DELETE&#39;,\n\t&#39;headers&#39; =&gt; array(\n\t\t&#39;Authorization&#39; =&gt; &#39;Basic &#39; . base64_encode( &#39;user_name:user_password&#39; )\n\t),\n) );\n<\/pre>\n<h4>Arguments\u00a0<\/h4>\n<table>\n<tbody>\n<tr>\n<td><strong>id<\/strong><\/td>\n<td>Unique identifier for the term.<\/td>\n<\/tr>\n<tr>\n<td><strong>force<\/strong><\/td>\n<td>Required to be true, Brands do not support trashing.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>To setup product brands for products, you can use the default <a href=\"https:\/\/woocommerce.github.io\/woocommerce-rest-api-docs\/#create-a-product\" target=\"_blank\" rel=\"noopener\">WooCommerce Rest API<\/a> and add to request <code class=\"inline-code\">etheme_brands<\/code> param: <strong>etheme_brands (array)<\/strong><\/p>\n<p>For example when creating the product<\/p>\n<pre>$api_response = wp_remote_post( &#39;https:\/\/example.com\/wp-json\/wc\/v3\/products\/&#39;, array(\n\t\t\t&#39;method&#39;    =&gt; &#39;POST&#39;,\n\t\t\t&#39;headers&#39; =&gt; array(\n\t\t\t\t&#39;Authorization&#39; =&gt; &#39;Basic &#39; . base64_encode( &#39;consumer_key:consumer_secret&#39; )\n\t\t\t),\n\t\t\t&#39;body&#39; =&gt; array(\n\t\t\t\t&#39;name&#39; =&gt; &#39;Premium Quality aaaaaaaaa&#39;,\n\t\t\t\t&quot;regular_price&quot; =&gt; &quot;21.99&quot;,\n\t\t        &quot;description&quot; =&gt; &quot;Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.&quot;,\n\t\t        &quot;short_description&quot; =&gt; &quot;Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.&quot;,\n\t\t\t\t&#39;etheme_brands&#39; =&gt; array(45,48),\n\t\t\t\t&quot;images&quot; =&gt; array(array(&quot;src&quot;=&gt; &quot;https:\/\/example.com\/wp-content\/uploads\/sites\/56\/2013\/06\/T_2_front.jpg&quot;),\n\t\t        ),\n\t\t\t)\n\t\t) );\n<\/pre>\n<p>For example when updating the product<\/p>\n<pre>$api_response = wp_remote_post( &#39;https:\/\/example.com\/wp-json\/wc\/v3\/products\/4953&#39;, array(\n\t\t&#39;method&#39;    =&gt; &#39;POST&#39;,\n\t\t&#39;headers&#39; =&gt; array(\n\t\t\t&#39;Authorization&#39; =&gt; &#39;Basic &#39; . base64_encode( &#39;consumer_key:consumer_secret&#39; )\n\t\t),\n\t\t&#39;body&#39; =&gt; array(\n\t        &quot;description&quot; =&gt; &quot;Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.&quot;,\n\t\t\t&#39;etheme_brands&#39; =&gt; array(45,48),\n\t\t)\n\t) );\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Brands (eteheme_brands) The schema defines all the fields that exist within a brand record. Any response from these endpoints can be expected to contain the fields below unless the _filter query parameter is used or the schema field only appears in a specific context. Schema id (integer) Unique identifier for the term. Read-only Context: view, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"doc_category":[48],"doc_tag":[],"class_list":["post-1779","docs","type-docs","status-publish","hentry","doc_category-xstore-hooks-filters"],"aioseo_notices":[],"year_month":"2026-07","word_count":1214,"total_views":"5621","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"author_nicename":"docs","author_url":"https:\/\/www.8theme.com\/documentation\/author\/docs\/"},"doc_category_info":[{"term_name":"XStore Hooks &amp; Filters","term_url":"https:\/\/www.8theme.com\/documentation\/xstore\/xstore-hooks-filters\/"}],"doc_tag_info":[],"author_list":[{"ID":"1","user_login":"docs","display_name":"docs","id":"1"}],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/docs\/1779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/comments?post=1779"}],"version-history":[{"count":0,"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/docs\/1779\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/media?parent=1779"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=1779"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.8theme.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=1779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}