Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Going over the API, there seems to be some overlap when it comes to expressing a predicate in a URL.

For example, let's say I want to fetch some questions from stackoverflow.com that have the tag "cocoa". According to the API, there are two ways to do it:

http://api.stackoverflow.com/1.0/search?tagged=cocoa
http://api.stackoverflow.com/1.0/questions?tagged=cocoa

(ignoring required query params like the API key, of course)

Are these guaranteed to return the same results? If not, how do should I decide which endpoint to use? There are some ways I could differentiate between them, such as if the user decides to sort the results by "hotness", then I know to use the "/questions" endpoint, since "/search" doesn't support the hotness sort key. But if the user wants to sort by "creation", then I've got a choice.

What would you do in this case? What should I do? (Right now I'm just arbitrarily picking one)

(It looks like they are returning stuff in the same order [at least, according to stackapi.com], but I'm wondering about a guarantee...)

share|improve this question
up vote 1 down vote accepted

/search is generally slower than /questions. You should use /questions unless you need one of the parameters on /search.

That said, ignoring caching differences, those two queries are equivalent.

share|improve this answer
    
Perfect, thank you! – Dave DeLong Jan 17 '11 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .