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.

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?

Thanks.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
    
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> –  marcamillion Feb 20 '13 at 23:48
    
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. –  Kevin Montrose Feb 21 '13 at 18:17
    
Ahh ok....so I guess the same thing applies to comments. –  marcamillion Feb 21 '13 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? –  marcamillion Feb 22 '13 at 22:40
add comment

You must log in to answer this question.

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