2

Would also be good if I could also find the top questions/answers in a particular tag - i.e. questions tagged with Ruby or PHP.

Per the docs the only thing I can see that will return questions in a particular tag is FAQs by tag.

There anyway for me to retrieve just the questions & answers in a specific tag?

1 Answer 1

3

/questions take's a semi-colon delimited list of tags in the tagged parameter. If tagged is set, questions returned will have all the passed tags (ie. it's an AND operator).

https://api.stackexchange.com/docs/questions#order=desc&sort=votes&tagged=python&filter=default&site=stackoverflow&run=true

^ for example, that query returns all questions tagged with python, highest voted questions first.

/search and /search/advanced expose a tagged parameter that is an OR instead of an AND, though those methods return fewer results than /questions.

5
  • What about answers & comments? I am using Serel, and I figured out the best way to achieve this for questions is something like this: Serel::Question.search.tagged('Ruby').pagesize(10).sort('votes'). But answers won't allow the search method for whatever reason. Also, how do I receive more results than just pagesize(100)? Once I try going to 101 it returns 0. I also tried has_more and that didn't work. For instance, I was trying to retrieve all the tags by doing Serel::Tag.total and that returned NoMethodError: undefined method 'total' for #<Serel::Relation:0x007f8d53a8fab0> Commented Feb 20, 2013 at 23:48
  • 1
    Only questions have tags, if you want answers to tagged questions you have to come at them from a question direction. For /questions or /search you can add question.answers to your filter to get the answers along with the question (as they're not included in the default filter). .total likewise isn't included by default. Maximum pagesize is 100, if you need more than 100 results you have to make multiple requests. Commented Feb 21, 2013 at 18:17
  • Ahh ok....so I guess the same thing applies to comments. Commented Feb 21, 2013 at 18:24
  • How do I get the number of tags on the system? I have gone through 1800 tags so far - are there really that many tags on SO? Commented Feb 22, 2013 at 22:40
  • @marcamillion As of today I see 1160 pages of tags on SO. At 30 tags each that is 34,800 tags total. Commented Jan 22, 2015 at 15:13

You must log in to answer this question.

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