Category Display

🚧

Only API keys on our Conversations PRR platform are eligible to use this API version. Refer to the Platforms section of our Platform & API Concepts documentation to learn which platform your API keys are on

Returns categories and related data.

Examples

🚧

Demonstration purposes only. Do not reuse the API passkeys below in your application.

Requesting all categories

https://stg.api.bazaarvoice.com/data/categories.json?apiversion=5.4&passkey=kuy3zj9pr3n7i0wxajrzj04xo

Requesting all categories sorted alphabetically by name

https://stg.api.bazaarvoice.com/data/categories.json?apiversion=5.4&sort=Name:asc&passkey=kuy3zj9pr3n7i0wxajrzj04xo

Requesting all active categories

https://stg.api.bazaarvoice.com/data/categories.json?apiversion=5.4&filter=IsActive:eq:true&passkey=kuy3zj9pr3n7i0wxajrzj04xo

Requesting a category by ID

https://stg.api.bazaarvoice.com/data/categories.json?apiversion=5.4&passkey=kuy3zj9pr3n7i0wxajrzj04xo&filter=id:testCategory1011

You can request for multiple categories by ID by separating the IDs with a comma. e.g. filter=id:1234,5678,3456

Requesting categories by category ancestor ID

https://stg.api.bazaarvoice.com/data/categories.json?apiversion=5.4&passkey=kuy3zj9pr3n7i0wxajrzj04xo&filter=ancestorid:testCategory1050

Category text search

https://stg.api.bazaarvoice.com/data/categories.json?apiversion=5.4&passkey=kuy3zj9pr3n7i0wxajrzj04xo&search=%22Retail%22

The results returns categories that contain the word "Retail".

Parameters

NameDescriptionRequiredDefault Value
ApiVersionThe API version, e.g. 5.4.Yes
[FORMAT]Response format (
xml This feature will not be available or will behave differently in future versions of the Conversations API. Click for more information.
or json)
Yes
PassKeyAPI key is required to authenticate API user and check permission to access particular client's data.Yes
CallbackCallback function name used with JSONP. Value is a string consisting of the following characters: a-z,A-Z,0-9,_ (excluding comma). See the JSONP tutorial for more information.No
FilterFilter criteria for primary content of the query. Multiple filter criteria are supported.No
IncludeThis parameter is used to specify related data to be included, e.g., Products, Questions, Answers .NoWill only return Answers
LimitMax number of records returned. An error is returned if the value passed exceeds 100.No10
Limit_TYPELimit option for the nested content type returned. TYPE can be any nested content. e.g. Answers for Questions. An error is returned if the value passed exceeds 20.No10
LocaleLocale to display Labels, Configuration, Product Attributes and Category Attributes in. The default value is the locale defined in the display associated with the API key.No
OffsetIndex at which to return results. By default, indexing begins at 0 when you issue a query. Using Limit=100, Offset=0 returns results 0-99. When changing this to Offset=1, results 1-100 are returned. The maximum supported value is 300000.No0
SearchFull-text search string used to find UGC. For more information about what fields are searched by default, see the Conversations API page.

Note: This invalidates sort options due to the fact that search takes precedence in returned data.
No
Search_[Type]Searching option for included content followed by full-text search string. See the Conversations API page for examples of searching for included data.

Note: This invalidates sort options due to the fact that search takes precedence in returned data.
No
SortSort criteria for Categories. Multi-attribute sorting is supported.NoId
StatsThe content types for which statistics can be calculated for the category. Available content types are: Stories , Questions, Answers. Note: Statistics can also be calculated on includes.No

Filter options

  • Each filter argument specifies the attribute to filter on followed by a comma-separated list of values. For instance, "Filter=Id:eq:5,6" will match all categories with Id 5 OR 6.
  • Advanced operators can be used to define filters. For instance, "Filter=Id:lte:50" will match all categories with an Id value of less than or equal to 50. All advanced operators are documented on the Conversations API page.
  • If a filter value contains a comma or a colon, that character needs to be escaped with a backslash (\, or \:). If a filter value contains an ampersand (&), the ampersand must be encoded in the filter value by replacing & with %26.
  • Multiple filters are allowed as URL parameters in which case filters are AND'ed. For instance, "Filter=AncestorId:eq:5&Filter=IsDisabled:eq:false" will match all categories that are not disabled and that have an ancestor category with Id 5.
  • Time-based filters can be used for LastAnswerTime, LastQuestionTime. Dates in time-based filters are calculated as the number of seconds since January 1, 1970, 00:00:00 UTC. In a future version, we will be adding support for comparing date/time string values. The following example returns content that has its last question submitted on November 9, 2009: &filter=LastQuestionTime:gt:1257746400&filter=LastQuestionTime:lt:1257832800

The following table lists the attributes available for filtering.

NameDescription
IdThe identifier of the Product Category.
AncestorIdId of the Ancestor of the Category.
IsActiveBoolean flag indicating whether the Category is Active.
IsDisabledBoolean flag indicating whether the Category is Disabled.
LastAnswerTimeThe Submission Time of the latest Answer that was submitted to a Question on the Category.
LastQuestionTimeThe Submission Time of the latest Question that was submitted on the Category.
NameThe Name of the Category.
ParentIdThe Id of the Parent of the Category.
TotalAnswerCountThe number of Answers that have been written to Questions on the Category.
TotalQuestionCountThe number of Questions that have been written on the Category.

Sort options

  • Sort order is required (asc or desc). There is no default.
  • Multi-attribute sorting is supported by using a comma separated list of sort criteria. e.g. Sort=ParentId:asc,SubmissionTime:desc

The following table lists the attributes that are available for sorting.

NameDescription
IdThe identifier of the Product Category.
IsActiveBoolean flag indicating whether the Category is Active.
IsDisabledBoolean flag indicating whether the Category is Disabled.
LastAnswerTimeThe Submission Time of the Answer that was submitted last on the Category.
LastQuestionTimeThe Submission Time of the latest Question that was submitted on the Category.
NameThe Name of the Category.
ParentIdThe identifier of the Parent of the Category.
TotalAnswerCountThe number of Answers that have been written to Questions on the Category.
TotalQuestionCountThe number of Questions that have been written on the Category.

Response format

Sample response to a Request for all categories limiting the display to 1 entry:

{
    "Includes": { },
    "HasErrors": false,
    "Offset": 20,
    "TotalResults": 548,
    "Locale": "en_US",
    "Errors": [ ],
    "Results": [
        {
            "Name": "Vests",
            "Attributes": {
                 "Department": {
                     "Values": [
                           {
                                "Value": "5",
                                "Locale": null
                            }
                        ],
                            "Id": "Department"
                 }
             },
            "ParentId": "WEB_SPECIALS.MENS",
            "QuestionIds": [ ],
            "AttributesOrder": [
                 "Department"
            ],
            "ImageUrl": null,
            "Id": "WEB_SPECIALS.MENS.VESTS",
            "ProductIds": [ ],
            "CategoryPageUrl": null
        }
    ],
    "Limit": 1
 
}

Sample response for Errors:

{
    "Error": {
        "Code": "[ERROR_CODE]",
        "Message": "[ERROR_MESSAGE]"
    }
}

Response elements

NameDescription
DataSection containing all the data matched by a query grouped by content/subject type. Within each data section there is a map of objects keyed by ids
ErrorsError section is populated instead of other fields if there is an error with a query syntax or problem executing a query.
LimitThe total number of results returned, specified by user in the URL. Defaults to 10 and has a maximum of 100.
OffsetDataset offset used for pagination (passed as URL parameter in a query request). The maximum supported value is 300000.
ResultsSection containing an array of primitive type object references matched by a query.
TotalResultsTotal number of records matched.

Error codes

ValueDescription
ERROR_ACCESS_DENIEDInsufficient privileges to perform the operation
ERROR_PARAM_INVALID_API_KEYInvalid API Key value
ERROR_PARAM_INVALID_CALLBACKInvalid JsonP callback function name
ERROR_PARAM_INVALID_FILTER_ATTRIBUTEInvalid filter attribute name
ERROR_PARAM_INVALID_INCLUDEDInvalid parameter value
ERROR_PARAM_INVALID_LIMITInvalid limit value
ERROR_PARAM_INVALID_LOCALEInvalid locale code
ERROR_PARAM_INVALID_OFFSETInvalid offset value
ERROR_PARAM_INVALID_SORT_ATTRIBUTEInvalid sort attribute name
ERROR_UNKNOWNUnknown error (internal server error, for instance)