2

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...)

1 Answer 1

1

/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.

0

You must log in to answer this question.

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