Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

You must log in to answer this question.

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