getHistograms

getHistograms returns category and/or aspect histogram information for the eBay category ID you specify. Histograms are item counts for the associated category or aspect value. Input category ID numbers in the request using the categoryId field.

Category histograms return histogram information for the specified eBay category, as well as for the immediate children categories of the specified category. Category histograms are returned for non-leaf categories only. Category histograms aren't returned for leaf catetgories, because they have no children categories.

Aspects are well-known, standardized characteristics of an item. For example, "Screen Size," "Processor Type," and "Processor Speed" could be aspects of Laptop PCs. Aspects can vary for different kinds of items. For example, the aspects of Laptop PCs are different from those of Women's Dresses (aspects for Women's Dresses might include "Sleeve Style," "Dress Length," and "Size"). Aspect histograms are returned for categories that map to domains. Typically, leaf categories are mapped to domains, but not all leaf categories have been mapped. In some cases, non-leaf categories, such as Binoculars & Telescopes (category ID 28179), may be mapped to domains.

You can retrieve the eBay category ID numbers from the response of this call and from the eBay web site. You can also obtain a complete list of eBay categories with the Trading API GetCategories call.

Related calls:



Back to top

getHistograms Input

The box below lists all fields that could be included in the call request. To learn more about an individual field or its type, click its name in the box (or scroll down to find it in the table below the box).

See also Samples.

<?xml version="1.0" encoding="utf-8"?>
<getHistogramsRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
  <categoryId> string </categoryId>
</getHistogramsRequest>
Argument Type Occurrence Meaning
categoryId string Required Specifies the category from which you want to retrieve histogram information.

If a specified category ID doesn't match an existing category for the site, eBay returns an invalid-category error message. To determine valid categories, use the Trading API GetCategories call.
Max length: 10.



Back to top

getHistograms Output

The box below lists all fields that might be returned in the response. To learn more about an individual field or its type, click its name in the box (or scroll down to find it in the table below the box).

See also Samples.

<?xml version="1.0" encoding="utf-8"?>
<getHistogramsResponse xmlns="http://www.ebay.com/marketplace/search/v1/services">
  <!-- Standard Output Fields -->
  <ack> AckValue </ack>
  <errorMessage> ErrorMessage 
    <error> ErrorData 
      <category> ErrorCategory </category>
      <domain> string </domain>
      <errorId> long </errorId>
      <exceptionId> token </exceptionId>
      <message> string </message>
      <parameter name="string"> ErrorParameter (string) </parameter>
      <!-- ... more parameter nodes here ... -->
      <severity> ErrorSeverity </severity>
      <subdomain> string </subdomain>
    </error>
    <!-- ... more error nodes here ... -->
  </errorMessage>
  <timestamp> dateTime </timestamp>
  <version> string </version>
  <!-- Call-specific Output Fields -->
  <aspectHistogramContainer> AspectHistogramContainer 
    <aspect name="string"> Aspect 
      <valueHistogram valueName="string"> AspectValueHistogram 
        <count> long </count>
      </valueHistogram>
      <!-- ... more valueHistogram nodes here ... -->
    </aspect>
    <!-- ... more aspect nodes here ... -->
    <domainDisplayName> token </domainDisplayName>
    <domainName> string </domainName>
  </aspectHistogramContainer>
  <categoryHistogramContainer> CategoryHistogramContainer 
    <categoryHistogram> CategoryHistogram 
      <categoryId> string </categoryId>
      <categoryName> string </categoryName>
      <childCategoryHistogram> CategoryHistogram 
        <categoryId> string </categoryId>
        <categoryName> string </categoryName>
      </childCategoryHistogram>
      <!-- ... more childCategoryHistogram nodes here ... -->
      <count> long </count>
    </categoryHistogram>
    <!-- ... more categoryHistogram nodes here ... -->
  </categoryHistogramContainer>
</getHistogramsResponse>
Return Value Type Occurrence Meaning
Standard Output Fields   [Jump to call-specific fields]
ack AckValue Always Indicates whether or not errors or warnings were generated during the processing of the request.

Applicable values:

•   Failure

(out) eBay encountered a fatal error during the processing of the request, causing the request to fail. When a serious application-level error occurs, the error is returned instead of the business data.

•   PartialFailure

(out) eBay successfully processed the request, but one or more non-fatal errors occurred during the processing. For best results, requests should return without warning messages. Inspect the message details and resolve any problems before resubmitting the request.

•   Success

(out) eBay successfully processed the request and the business data is returned in the response. Note that it is possible for a response to return Success, but still not contain the expected data in the result.

•   Warning

(out) The request was successfully processed, but eBay encountered a non-fatal error during the processing. For best results, requests should return without warnings. Inspect the warning details and resolve the problem before resubmitting the request.


errorMessage ErrorMessage Conditionally Description of an error or warning that occurred when eBay processed the request. Not returned if the ack value is Success.
errorMessage.error ErrorData Conditionally,
repeatable: [0..*]
Details about a single error.
errorMessage.error.category ErrorCategory Conditionally There are three categories of errors: request errors, application errors, and system errors.

Applicable values:

•   Application

(out) An error occurred due to a problem with the request, with the most likely source being the application sending the request. For example, the request is missing a required data element or it contains an invalid field. The problem must be corrected before the request can be resent. Inspect the error message to find the cause of the problem. If the problem is due to an application error, modify the application and resend the request. If the error is due to invalid data, the source of the data must be corrected before you resend the resend request to eBay.

•   Request

(out) An error occurred due to a problem with the request, with the most likely source being missing or invalid data in the request. The problem must be corrected before the request can be retried. Inspect the error message to find the cause of the problem. If the problem is a result of end-user data, alert the end-user to the problem and provide the means for them to correct the problem. Once the problem is resolved, resend the request to eBay.

•   System

(out) Indicates that an error has occurred on the eBay system side. For example, a database or server could be down. Inspect the error message to find the cause of the problem. If the problem is on the eBay side, an application can retry the request as-is a reasonable number of times (eBay recommends twice). If the error persists, contact Developer Technical Support. Once the problem has been resolved, the request may be resent in its original form.


errorMessage.error.domain string Conditionally Name of the domain in which the error occurred.
domain values:
Marketplace
A business or validation error occurred in the service.
SOA
An exception occurred in the Service Oriented Architecture (SOA) framework.
errorMessage.error.errorId long Conditionally A unique code that identifies the particular error condition that occurred. Your application can use error codes as identifiers in your customized error-handling algorithms.
errorMessage.error.exceptionId token Conditionally Unique identifier for an exception associated with an error.
errorMessage.error.message string Conditionally A detailed description of the condition that caused in the error.
errorMessage.error.parameter ErrorParameter (string) Conditionally,
repeatable: [0..*]
Various warning and error messages return one or more variables that contain contextual information about the error. This is often the field or value that triggered the error.
errorMessage.error.parameter
  [ attribute name ]
string Conditionally The name of the input parameter returned with the error. Inspecting the parameter (or its input value) will often aid in understanding the cause of the error. Not all error messages contain this value.
errorMessage.error.severity ErrorSeverity Conditionally Indicates whether the reported problem is fatal (an error) or is less- severe (a warning). Review the error message details for information on the cause.

If the request fails and the application is the source of the error (for example, a required element is missing), update the application before you retry the request. If the problem is due to incorrect user data, alert the end-user to the problem and provide the means for them to correct the data. Once the problem in the application or data is resolved, re-send the request to eBay.

If the source of the problem is on eBay's side, you can retry the request a reasonable number of times (eBay recommends you try the request twice). If the error persists, contact Developer Technical Support. Once the problem has been resolved, you can resend the request in its original form.

If a warning occurs, warning information is returned in addition to the business data. Normally, you do not need to resend the request (as the original request was successful). However, depending on the cause of the warning, you might need to contact the end user, or eBay, to effect a long term solution to the problem.

Applicable values:

•   Error

(out) eBay encountered a fatal error during the processing of the request, causing the request to fail. When eBay encounters an error, it returns error data instead of the requested business data. Inspect the error details and resolve the problem before resubmitting the request.

•   Warning

(out) The request was successfully processed, but eBay encountered a non-fatal error during the processing that could affect the data returned. For example, eBay might have changed the value of an input field. In this case, eBay returns a successful response, but it also returns a warning. For best results, requests should return without warnings. Inspect the warning details and resolve the problem before resubmitting the request.


errorMessage.error.subdomain string Conditionally Name of the subdomain in which the error occurred.
subdomain values:
Finding
The error is specific to the Finding service.
MarketplaceCommon
The error is common to all Marketplace services.
timestamp dateTime Always This value represents the date and time when eBay processed the request. This value is returned in GMT, the ISO 8601 date and time format (YYYY- MM- DDTHH:MM:SS.SSSZ). See the "dateTime" type for information about the time format, and for details on converting to and from the GMT time zone.
version string Always The release version that eBay used to process the request. Developer Technical Support may ask you for the version value if you work with them to troubleshoot issues.

Note: The version in use is normally the latest release version, as specified in the release notes. Note that eBay releases the API to international sites about a week after the API version is released to the US site.
Call-specific Output Fields
aspectHistogramContainer AspectHistogramContainer Conditionally Response container for aspect histograms. Aspect histograms are returned for categories that have been mapped to domains only. In most cases, just leaf categories are mapped to domains, but there are exceptions.
aspectHistogramContainer
  .aspect
Aspect Conditionally,
repeatable: [1..*]
A characteristic of an item in a domain. For example, "Optical Zoom", "Brand", and "Megapixels" could be aspects of the Digital Cameras domain. Aspects are well-known, standardized characteristics of a domain, and they vary from domain to domain (the aspects of "Men's Shoes" are different from those of "Digital Cameras"). A search request on the eBay site will often display aspects and their respective aspect values on the left-had side of a query response.

Aspects are extracted from item listing properties (such as item titles and subtitles), and represent the characteristics of active items. Values returned in the Aspect container can be used as inputs to the aspectFilter fields in a query to distill the items returned by the query. eBay generates aspects dynamically from the items currently listed; aspects provide a view into what is currently available on eBay. Because of this, aspect values returned one day cannot be guaranteed to be valid the next day.

The following graphic shows how eBay might return a set of aspects for the Digital Cameras domain. In this graphic, "Product Type", "Brand", and "Megapixels" are aspects, and "Point & Shoot", "Canon", and "12.0 to 12.9 MP" are aspect values. Histogram values (item counts) are shown for each aspect value.

eBay Aspects
aspectHistogramContainer
  .aspect
  [ attribute name ]
string Conditionally Name of an aspect that is part of a domain. For example, "Optical Zoom" or "Megapixels" could be aspects of the Digital Cameras domain. For the current aspect names associated with a specific item, refer to the aspectHistogramContainer returned for the respective item.

This value is not returned if there are no matching aspects for the associated domain.
aspectHistogramContainer
  .aspect.valueHistogram
AspectValueHistogram Conditionally,
repeatable: [0..*]
Container that returns the name of the respective aspect value and the histogram (the number of available items) that share that item characteristic.

This value is not returned if there are no matching aspects for the associated domain.
aspectHistogramContainer
  .aspect.valueHistogram
  [ attribute valueName ]
string Conditionally Name of an aspect value. For example, "Short Sleeve" could be an aspect value of the Sleeve Style aspect in the Women's Dresses domain, or "Athletic" could be an aspect value of the Style aspect in the Men's Shoes domain.
aspectHistogramContainer
  .aspect.valueHistogram.count
long Conditionally Number of items that share the characteristic the respective aspect value.
aspectHistogramContainer
  .domainDisplayName
token Conditionally A buy-side group of items, for example "Shoes." Domains are extracted from item listing properties, such as the title, descriptions, and so on.
aspectHistogramContainer
  .domainName
string Conditionally A buy-side group of items that share aspects, but not necessarily an eBay category. For example "Women's Dresses" or "Digital Cameras" could be domains. You can use a domainName to label a set of aspects that you display.

Domains are extracted from item listing properties (such as item titles and subtitles).
categoryHistogramContainer CategoryHistogramContainer Conditionally Response container for category histograms. This container is returned only when the specified category has children categories.

Note: Category histograms may not be available for some parent categories on the eBay Motors site.
categoryHistogramContainer
  .categoryHistogram
CategoryHistogram Conditionally,
repeatable: [0..*]
Statistical (item count) information on the categories that contain items that match the search criteria or specified category or categories. A category histogram contains information for up to 10 child categories. Search result total entries may not necessarily match the sum of category histogram item counts.

For search calls, the item count shows the distribution of matching items across each of the returned categories. A category histogram is not returned if there are no matching items or if the search is restricted to a single leaf category.

For getHistograms, the category histogram contains the total item count for the specified category and item counts for the child categories containing the most item listings. A category histogram is not returned if the specified category is a leaf category.

For categories associated with specific items, review the individual item containers returned in the search result.
categoryHistogramContainer
  .categoryHistogram.categoryId
string Conditionally The unique ID of a category on the specified eBay site.
Max length: 10.
categoryHistogramContainer
  .categoryHistogram
  .categoryName
string Conditionally Display name of a category as it appears on the eBay Web site.
Max length: 30.
categoryHistogramContainer
  .categoryHistogram
  .childCategoryHistogram
CategoryHistogram Conditionally,
repeatable: [0..10]
Container for histogram information pertaining to a child of the category specified in the request. Histograms return data on up to 10 children. Histograms are only a single level deep. That is, a given category histogram contains only immediate children.
categoryHistogramContainer
  .categoryHistogram
  .childCategoryHistogram
  .categoryId
string Conditionally The unique ID of a category on the specified eBay site.
Max length: 10.
categoryHistogramContainer
  .categoryHistogram
  .childCategoryHistogram
  .categoryName
string Conditionally Display name of a category as it appears on the eBay Web site.
Max length: 30.
categoryHistogramContainer
  .categoryHistogram.count
long Conditionally The total number of items in the associated category that match the search criteria.



Back to top

getHistograms Detail Controls

This call does not use a detail control mechanism.



Back to top

getHistograms Samples

New to making API calls? Please see Making an API 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: Basic Call

Retrieves a set of category and aspect histograms for a specified category.

Description

The user is interested in music and wants to see the distribution of the type of music media and accessories available on eBay. Category histograms display items counts for the specified category.

The response contains histogram information (item counts) for the specified category, Music (category ID 11233), as well as a list of the immediate sub- categories (child categories) with their associated item counts. In addition to category histograms, the response also contains aspect histogram information that can be used to refine the result sets in subsequent find calls. Usually, aspect histograms are returned for leaf categories only, but there are a few exceptions, such as the Music category.

You can retrieve the eBay categoryId numbers from the response of this call and from the eBay web site. You can also obtain a complete list of eBay categories with the getCategories call in the Trading API.

Input

The categoryId field specifies the category for which the histograms are returned.

Note: URL samples have been wrapped for readability. To run the samples, undo the line wrapping and insert your own SECURITY-APPNAME.

URL format (HTTP GET). See also the non-wrapped version of this URL. For results in a format other than XML, 
specify a different value for responseencoding.
http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=getHistograms
   &SERVICE-VERSION=1.0.0
   &SECURITY-APPNAME=YourAppID
   &RESPONSE-DATA-FORMAT=XML
   &REST-PAYLOAD
   &categoryId=11233

   Here is the same input in XML format (HTTP POST). Note that this does not include standard values.

XML format (HTTP POST). Also available is the .txt version of this XML.

<?xml version="1.0" encoding="UTF-8"?>
<getHistogramsRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
  <categoryId>11233</categoryId>
</getHistogramsRequest>

Output

XML format. Also available is the .txt version of this XML.

<?xml version="1.0" encoding="utf-8"?>
<getHistogramsResponse xmlns:ms="http://www.ebay.com/marketplace/services"
xmlns="http://www.ebay.com/marketplace/search/v1/services">
   <ack>Success</ack>
   <version>1.0.0</version>
   <timestamp>2009-07-31T00:33:12.891Z</timestamp>
    <categoryHistogramContainer>
      <categoryHistogram>
         <categoryId>11233</categoryId>
         <categoryName>Music</categoryName>
         <count>1807588</count>
         <childCategoryHistogram>
            <categoryId>307</categoryId>
            <categoryName>CDs</categoryName>
            <count>1448859</count>
         </childCategoryHistogram>
         <childCategoryHistogram>
            <categoryId>306</categoryId>
            <categoryName>Records</categoryName>
            <count>261008</count>
         </childCategoryHistogram>
         <childCategoryHistogram>
            <categoryId>31608</categoryId>
            <categoryName>Wholesale Lots</categoryName>
            <count>20875</count>
         </childCategoryHistogram>
         <childCategoryHistogram>
            <categoryId>1600</categoryId>
            <categoryName>Cassettes</categoryName>
            <count>18448</count>
         </childCategoryHistogram>
         <childCategoryHistogram>
            <categoryId>618</categoryId>
            <categoryName>Other Formats</categoryName>
            <count>17942</count>
         </childCategoryHistogram>
         <childCategoryHistogram>
            <categoryId>52473</categoryId>
            <categoryName>Accessories</categoryName>
            <count>4878</count>
         </childCategoryHistogram>
         <childCategoryHistogram>
            <categoryId>46353</categoryId>
            <categoryName>DVD Audio</categoryName>
            <count>1572</count>
         </childCategoryHistogram>
         <childCategoryHistogram>
            <categoryId>46354</categoryId>
            <categoryName>Super Audio CDs</categoryName>
            <count>1205</count>
         </childCategoryHistogram>
      </categoryHistogram>
   </categoryHistogramContainer>
   <aspectHistogramContainer>
      <domainName>Music_CDs</domainName>
      <domainDisplayName>Music CDs</domainDisplayName>
      <aspect name="Genre">
         <valueHistogram valueName="Blues">
            <count>30383</count>
         </valueHistogram>
         <valueHistogram valueName="Children's">
            <count>9782</count>
         </valueHistogram>
         <valueHistogram valueName="Christian & Gospel">
            <count>33357</count>
         </valueHistogram>
         <valueHistogram valueName="Classical">
            <count>172756</count>
         </valueHistogram>
         <valueHistogram valueName="Comedy">
            <count>6206</count>
         </valueHistogram>
         <valueHistogram valueName="Country">
            <count>62644</count>
         </valueHistogram>
         <valueHistogram valueName="Dance, DJ & Electronic">
            <count>44756</count>
         </valueHistogram>
         <valueHistogram valueName="Easy Listening">
            <count>12081</count>
         </valueHistogram>
         <valueHistogram valueName="Folk">
            <count>17440</count>
         </valueHistogram>
         <valueHistogram valueName="Holiday">
            <count>8843</count>
         </valueHistogram>
         <valueHistogram valueName="Jazz">
            <count>115272</count>
         </valueHistogram>
         <valueHistogram valueName="Karaoke">
            <count>5122</count>
         </valueHistogram>
         <valueHistogram valueName="Latin">
            <count>43218</count>
         </valueHistogram>
         <valueHistogram valueName="Metal">
            <count>57697</count>
         </valueHistogram>
         <valueHistogram valueName="New Age">
            <count>15291</count>
         </valueHistogram>
         <valueHistogram valueName="Pop">
            <count>66613</count>
         </valueHistogram>
         <valueHistogram valueName="R&B & Soul">
            <count>81852</count>
         </valueHistogram>
         <valueHistogram valueName="Rap & Hip Hop">
            <count>22742</count>
         </valueHistogram>
         <valueHistogram valueName="Reggae & Ska">
            <count>13967</count>
         </valueHistogram>
         <valueHistogram valueName="Rock">
            <count>370884</count>
         </valueHistogram>
         <valueHistogram valueName="Soundtrack & Theater">
            <count>41259</count>
         </valueHistogram>
         <valueHistogram valueName="Spoken Word & Interviews">
            <count>2573</count>
         </valueHistogram>
         <valueHistogram valueName="World Music">
            <count>61575</count>
         </valueHistogram>
         <valueHistogram valueName="Not Specified">
            <count>143597</count>
         </valueHistogram>
      </aspect>
      <aspect name="Duration">
         <valueHistogram valueName="Album or EP">
            <count>910263</count>
         </valueHistogram>
         <valueHistogram valueName="Single">
            <count>28557</count>
         </valueHistogram>
         <valueHistogram valueName="Box Set">
            <count>19462</count>
         </valueHistogram>
         <valueHistogram valueName="Not Specified">
            <count>482163</count>
         </valueHistogram>
      </aspect>
      <aspect name="Condition">
         <valueHistogram valueName="Brand New">
            <count>1097853</count>
         </valueHistogram>
         <valueHistogram valueName="Like New">
            <count>169018</count>
         </valueHistogram>
         <valueHistogram valueName="Very Good">
            <count>106884</count>
         </valueHistogram>
         <valueHistogram valueName="Good">
            <count>30592</count>
         </valueHistogram>
         <valueHistogram valueName="Acceptable">
            <count>35559</count>
         </valueHistogram>
         <valueHistogram valueName="Not Specified">
            <count>28</count>
         </valueHistogram>
      </aspect>
      <aspect name="Special Attributes">
         <valueHistogram valueName="Import">
            <count>37337</count>
         </valueHistogram>
         <valueHistogram valueName="Remastered">
            <count>15264</count>
         </valueHistogram>
         <valueHistogram valueName="Special Edition">
            <count>12506</count>
         </valueHistogram>
         <valueHistogram valueName="Promo">
            <count>11828</count>
         </valueHistogram>
         <valueHistogram valueName="Digipak">
            <count>10916</count>
         </valueHistogram>
         <valueHistogram valueName="Enhanced CD">
            <count>5771</count>
         </valueHistogram>
         <valueHistogram valueName="Compilation">
            <count>1225</count>
         </valueHistogram>
         <valueHistogram valueName="24k Gold Disc">
            <count>899</count>
         </valueHistogram>
         <valueHistogram valueName="Not Specified">
            <count>1351543</count>
         </valueHistogram>
      </aspect>
   </aspectHistogramContainer>
</getHistogramsResponse>



Back to top

getHistograms Change History
Version Description
1.0.0
06/24/2009
  • (added) New call.

This document was generated with a customized version of the apireferencedocs tool.

© 2009 eBay, Inc. All rights reserved. This documentation and the API may only be used in accordance with the eBay Developers Program and API License Agreement.