getCategoryTraits
Retrieves full information about all item traits for a given category. For example, in the "Comic Books" category, applicable item traits might include "Year Published," "Publisher," and "Condition." This information can be used when posting or editing an item, or item traits can be applied as filters to narrow down search results.
getCategoryTraits Input
getCategoryTraitsis a non-secure request with the following URL and HTTP header requirements:
Submit to URL: | https://api.bonanza.com/api_requests/standard_request |
Required in HTTP header: | X-BONANZLE-API-DEV-NAME set to your dev_id |
The name for your request should be getCategoryTraitsRequest.
So, for example, here is the Ruby code to submit your request:
require "json" require "net/http" # Open connection to api.bonanza.com over port 443 http = Net::HTTP.new("api.bonanza.com", 443) http.use_ssl = true http.post( "/api_requests/standard_request", # The path we're posting to "getCategoryTraitsRequest=your_serialized_JSON_data", # The data being posted { 'X-BONANZLE-API-DEV-NAME' => 'abcdef123456' } # The HTTP header, which gives your dev_id )
Here are the available input parameters that can be serialized into JSON:
Argument | Type | Occurrence | Meaning |
---|---|---|---|
Call-specific Input Fields | |||
categoryId | integer | Required | The numeric ID of the category whose traits you want to grab. |
getCategoryTraits Output
The name for the output returned from this request is getCategoryTraitsResponse. So, after parsing the serialized response into JSON, you can access the data with something like:
my_json_hash['getCategoryTraitsResponse']
Here are all the possible output parameters:
Argument | Type | Occurrence | Meaning |
---|---|---|---|
Standard Output Fields | |||
errorMessage | Container | Conditionally | Description of an error or warning that occurred when Bonanza processed the request. Not returned if the ack value is Success. |
errorMessage.error | Container |
Conditionally, repeatable: [0..*] |
|
errorMessage.error.category | ErrorCategory | Conditionally | Currently unused. |
errorMessage.error.message | string | Conditionally | A description of the error |
errorMessage.error.type | ErrorType | Conditionally | A unique descriptive name for the error. |
timestamp | dateTime | Always | This value represents the date and time when Bonanza processed the request. The time zone of this value is GMT and the format is the ISO 8601 date and time format (YYYY-MM-DDTHH:MM:SS.SSSZ). See the "dateTime" type for information about this time format and converting to and from the GMT time zone. |
warnings | Container | Conditionally | Description of a warning that occurred when Bonanza processed the request. |
warnings.unrecognized_parameters | Container |
Conditionally, repeatable: [0..*] |
An array of unrecognized parameters. |
warnings.category_deleted | Container | Conditionally | The input category is no longer in use on Bonanza. Please use getCategories or visit your dashboard to download the latest categories. |
Call-specific Output Fields | |||
traitArray | Container | Always, repeatable: [0..*] | Contains an array of the available traits for a given category. |
traitArray.htmlInputType | string | Always | The type of item trait this is. Possible values include:
|
traitArray.id | integer | Always | The unique ID for this item trait. |
traitArray.label | string | Always | The name for this trait. For example, "material," "color," "brand," etc. |
traitArray.parentTraitId | integer | Always | The ID of this trait's parent. Can be useful when traversing through search results, to know that a trait like "Color" maps from "Collectibles" to "Decorative Collectibles." |
traitArray.variationsEnabled | boolean | Always | Returns true if this is a trait that can have variations specified for it. See addFixedPriceItem for more details on variations. |
traitArray.requestSellerInput | boolean | Always | Returns true if this is a trait that Bonanza would prefer is requested of the seller and included for item creation. |
traitArray.traitValues | Container | Conditionally, repeatable: [0..*] | Contains an array of the possible values for traits, only applicable when trait's htmlInputType is "dropdown." |
traitArray.traitValues.displayOrder | integer | Conditionally | The order in which this trait value should be presented, if displayed in a list. Lower numbers should be at top of list. |
traitArray.traitValues.name | string | Conditionally | The name of this trait value, for example, "green," "red," "leather," "new," etc. |
traitArray.traitValues.searchId | integer | Conditionally | The integer to use as a filter to findItemsByKeywords to filter only search results that have this item trait set. |