taxonomy APIv1_beta.2.0

getCategorySubtree

GET
/category_tree/{category_tree_id}/get_category_subtree
This call retrieves the details of all nodes of the category tree hierarchy (the subtree) below a specified category of a category tree. You identify the tree using the category_tree_id parameter, which was returned by the getDefaultCategoryTreeId call in the categoryTreeId field.

Note: This call can return a very large payload, so you are strongly advised to submit the request with the following HTTP header:

  Accept-Encoding: application/gzip

With this header (in addition to the required headers described under HTTP Request Headers), the call returns the response with gzip compression.

Input

Resource URI (production)

GET https://api.ebay.com/commerce/taxonomy/v1_beta/category_tree/{category_tree_id}/get_category_subtree?

URI parameters

ParameterTypeDescription
category_idstringThe unique identifier of the category at the top of the subtree being requested.

Note: If the category_id submitted identifies the root node of the tree, this call returns an error. To retrieve the complete tree, use this value with the getCategoryTree call.

If the category_id submitted identifies a leaf node of the tree, the call response will contain information about only that leaf node, which is a valid subtree.

Occurrence: Required

category_tree_idstringThe unique identifier of the eBay category tree from which a category subtree is being requested.

Occurrence: Required

HTTP request headers

All requests made to eBay REST operations require you to provide the Authorization HTTP header for authentication authorization.

OAuth scope

This request requires an access token created with the client grant flow, using one scope from the following list:

https://api.ebay.com/oauth/api_scope

See Oauth access tokens for more information.

Output

HTTP response headers

Output container/fieldTypeDescription
categorySubtreeNodeCategoryTreeNodeContains details of all nodes of the category subtree hierarchy below a specified node. This is a recursive structure.

Occurrence: Always

categorySubtreeNode.categoryCategoryContains details about the current category tree node.

Occurrence: Always

categorySubtreeNode.category.categoryIdstringThe unique identifier of the eBay category within its category tree.

Note: The root node of a full default category tree includes the categoryId field, but its value should not be relied upon. It provides no useful information for application development.

Occurrence: Always

categorySubtreeNode.category.categoryNamestringThe canonical name of the category identified by categoryId.

Note: Don't depend on category names to be unique within a given category tree.

Occurrence: Always

categorySubtreeNode.categoryTreeNodeLevelintegerThe absolute level of the current category tree node in the hierarchy of its category tree.

Note: The root node of any full category tree is always at level 0.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodesarray of CategoryTreeNodeAn array of one or more category tree nodes that are the immediate children of the current category tree node, as well as their children, recursively down to the leaf nodes.

Returned only if the the current category tree node is not a leaf node (the value of leafCategoryTreeNode is false).

Occurrence: Conditional

categorySubtreeNode.childCategoryTreeNodes.categoryCategoryContains details about the current category tree node.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodes.category.categoryIdstringThe unique identifier of the eBay category within its category tree.

Note: The root node of a full default category tree includes the categoryId field, but its value should not be relied upon. It provides no useful information for application development.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodes.category.categoryNamestringThe canonical name of the category identified by categoryId.

Note: Don't depend on category names to be unique within a given category tree.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodes.categoryTreeNodeLevelintegerThe absolute level of the current category tree node in the hierarchy of its category tree.

Note: The root node of any full category tree is always at level 0.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodes.childCategoryTreeNodesarray of CategoryTreeNodeAn array of one or more category tree nodes that are the immediate children of the current category tree node, as well as their children, recursively down to the leaf nodes.

Returned only if the the current category tree node is not a leaf node (the value of leafCategoryTreeNode is false).

Occurrence: Conditional

categorySubtreeNode.childCategoryTreeNodes.childCategoryTreeNodes.categoryCategoryContains details about the current category tree node.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodes.childCategoryTreeNodes.category.categoryIdstringThe unique identifier of the eBay category within its category tree.

Note: The root node of a full default category tree includes the categoryId field, but its value should not be relied upon. It provides no useful information for application development.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodes.childCategoryTreeNodes.category.categoryNamestringThe canonical name of the category identified by categoryId.

Note: Don't depend on category names to be unique within a given category tree.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodes.childCategoryTreeNodes.categoryTreeNodeLevelintegerThe absolute level of the current category tree node in the hierarchy of its category tree.

Note: The root node of any full category tree is always at level 0.

Occurrence: Always

categorySubtreeNode.childCategoryTreeNodes.childCategoryTreeNodes.childCategoryTreeNodesarray of CategoryTreeNodeAn array of one or more category tree nodes that are the immediate children of the current category tree node, as well as their children, recursively down to the leaf nodes.

Returned only if the the current category tree node is not a leaf node (the value of leafCategoryTreeNode is false).

Occurrence: Conditional

categorySubtreeNode.childCategoryTreeNodes.childCategoryTreeNodes.leafCategoryTreeNodebooleanA value of true indicates that the current category tree node is a leaf node (it has no child nodes). A value of false indicates that the current node has one or more child nodes, which are identified by the childCategoryTreeNodes array.

Returned only if the value of this field is true.

Occurrence: Conditional

categorySubtreeNode.childCategoryTreeNodes.childCategoryTreeNodes.parentCategoryTreeNodeHrefstringThe href portion of the getCategorySubtree call that retrieves the subtree below the parent of this category tree node.

Not returned if the current category tree node is the root node of its tree.

Occurrence: Conditional

categorySubtreeNode.childCategoryTreeNodes.leafCategoryTreeNodebooleanA value of true indicates that the current category tree node is a leaf node (it has no child nodes). A value of false indicates that the current node has one or more child nodes, which are identified by the childCategoryTreeNodes array.

Returned only if the value of this field is true.

Occurrence: Conditional

categorySubtreeNode.childCategoryTreeNodes.parentCategoryTreeNodeHrefstringThe href portion of the getCategorySubtree call that retrieves the subtree below the parent of this category tree node.

Not returned if the current category tree node is the root node of its tree.

Occurrence: Conditional

categorySubtreeNode.leafCategoryTreeNodebooleanA value of true indicates that the current category tree node is a leaf node (it has no child nodes). A value of false indicates that the current node has one or more child nodes, which are identified by the childCategoryTreeNodes array.

Returned only if the value of this field is true.

Occurrence: Conditional

categorySubtreeNode.parentCategoryTreeNodeHrefstringThe href portion of the getCategorySubtree call that retrieves the subtree below the parent of this category tree node.

Not returned if the current category tree node is the root node of its tree.

Occurrence: Conditional

categoryTreeIdstringThe unique identifier of the eBay category tree to which this subtree belongs.

Occurrence: Always

categoryTreeVersionstringThe version of the category tree identified by categoryTreeId. It's a good idea to cache this value for comparison so you can determine if this category tree has been modified in subsequent calls.

Occurrence: Always

HTTP status codes

This call can return one of the following HTTP status codes. For an overview of the status codes, see HTTP status codes in Using eBay RESTful APIs.

StatusMeaning
200Success
400Bad Request
404Not Found
500Internal Server Error

Error codes

CodeDomainCategoryMeaning
62000API_TAXONOMYAPPLICATIONThere was a problem with an eBay internal system or process. Contact eBay developer support for assistance.
62004API_TAXONOMYREQUESTThe specified category tree ID was not found.
62005API_TAXONOMYREQUESTThe specified category ID does not belong to the specified category tree.
62006API_TAXONOMYREQUESTMissing category ID.
62008API_TAXONOMYREQUESTThe specified category ID is the root for the category tree. Please use <code>{categoryTreeHref}</code> to retrieve the entire tree.

Samples

New to making API calls? Please see Making a Call.

Note: Some item IDs, user IDs, or other data in these samples might no longer be active on eBay. If necessary, you can substitute current eBay data in your requests.

Sample 1: Get a subtree of a category tree

This sample retrieves the complete content of a subtree of an eBay category tree, using the category tree node that contains the specified category as the root of the desired subtree.

Input

Use the category_tree_id path parameter to specify the category tree, and use the category_id query parameter to specify the category in the category node at the top of the subtree being requested.
GET
https://api.ebay.com/commerce/taxonomy/v1_beta/category_tree/0/get_category_subtree?category_id=11450

Output

A successful call returns the complete category subtree specified, from the specified category node to all leaf nodes of the subtree. In this sample, the returned category subtree contains almost 600 categories, so the response shown here has most of the nodes removed for easier viewing.