Yahoo! Answers: Get Questions By Category

getByCategory lists open, resolved, or up-for-vote questions in the category of your choice, and is a good data source for getQuestion and getByUser. Requires a category name or ID, which are returned by the questionSearch service, or may be found on the Answers site.

Request URL: GET

http://answers.yahooapis.com/AnswersService/V1/getByCategory

GET Request parameters

See information on constructing REST queries

Parameter Value Description
appid string (required) The application ID. See Application IDs for more information.
category_id integer (either this or category_name is required) Category ID: matches the category ID seen in the request urls when browsing Yahoo! Answers categories.
category_name string (either this or category_id is required) Category Name: The full path to the English category name as found on the Yahoo! Answers site. Category names are case-sensitive and should be URL-encoded. Computers & Internet>Software, for example, looks like this: Computers+%26+Internet%3ESoftware
type string: omit for default "all" Question status. Set to "all", "resolved", "open", or "undecided".
region string: omit for default "us". Filter based on country:
  • us: United States
  • uk: United Kingdom
  • ca: Canada
  • au: Australia
  • in: India
  • es: Spain
  • br: Brazil
  • ar: Argentina
  • mx: Mexico
  • e1: en Espanol
  • it: Italy
  • de: Germany
  • fr: France
  • sg: Singapore
You can enter multiple regions. The first will determine the destination country of hyperlinks.
sort string: omit for default "date_desc" Result set sort field and order
  • date_desc: By date, descending from most recent,
  • date_asc: By date, ascending from oldest.
  • ans_count_desc: By answer count, descenting from highest.
  • ans_count_asc: By answer count, ascending from lowest.
start integer: default 0 Starting question to list, used to display further results.
results integer : default 10, max 50 Number of questions to be returned.
output string: omit for default "xml" Defines the output for the call. Accepted values are "xml", "json", "php", and "rss".
callback string: default "" If set, wraps the JSON object in call to the selected function. Only makes sense if output selected is JSON.

Sample Request using Category ID: http://answers.yahooapis.com/AnswersService/V1/getByCategory?appid=YahooDemo&category_id=396545664

Sample Request using Category Name: http://answers.yahooapis.com/AnswersService/V1/getByCategory?appid=YahooDemo&category_name=Computers+%26+Internet%3ESoftware

Both of these should show the last few questions from Computers & Internet > Software.

Response fields

The schema document for this service response is located at http://answers.yahooapis.com/AnswersService/V1/QuestionResponse.xsd

FieldDescription
ResultSetContains all of the questions listed.
QuestionContain an individual question's data. Has attributes:

  • id: The unique question id
  • type: The state of the question.
SubjectThe subject of the question
ContentThe full question
DatePre-formatted date when the question was submitted
TimestampUnix timestamp for when the question was submitted
LinkLink to the question
CategoryThe Category that the question is listed under. Has attribute:
  • id: The unique category id
UserIdThe unique User id
UserNickThe nickname of the user
UserPhotoURLUser photo URL.
NumAnswersThe number of answers to the question
NumCommentsThe number of comments on the question
ChosenAnswerThe answer chosen by the user as the best
ChosenAnswererIdThe user id of the chosen answerer
ChosenAnswererNickThe nickname of the chosen answerer
ChosenAnswererTimestampThe time the answer was submitted
ChosenAnswererAwardTimestampThe time the answer was given an award

Sample response

The following is a sample response for category Computers & Internet > Software:

Rate Limits

Yahoo! Web Search web services are limited to 5,000 queries per IP per day per API. See information on rate limiting and our Usage Policy to learn about acceptable uses and how to request additional queries.

Errors

The Yahoo! Answers Web Search services return the standard errors. There are no service-specific errors.

Ready to get started?

By applying for an Application ID for this service, you hereby agree to the Terms of Use