I am looking for an API which helps in fetching all the Questions & Answers from SO and other Stack Exchange sites only on a particular "keyword". Later using XML RPC these questions will be posted as blog post and answers to this post's answers. Just wondering whether it's possible with an API. One of my friend suggested that we should Scrape but i don't want screen scraping instead i am looking for API requests which should handle this.
2 Answers
Of course there is, have a look at the /search route documentation:*
Summary
Searches questions. One of intitle, tagged, or nottagged must be set. Searches that are purely text based should be routed through a third-party search engine, for performance reasons
Give it a try and retrieve all questions tagged api-v2
.
- Obviously this assumes equality between keyword and tag ;)
- While in principle you might want to search for keywords in the question body, which are not in the tag list already, this seems rather unlikely and will yield dubious results given that tags are the main question categorization used on the sites. If you really want to search for keywords outside of tags you would need to resort to a third-party search engine, as described in the summary.
The result neither includes question bodies nor answer details yet, so you'll have to retrieve those in a second step, have a look at the /questions/{id} route documentation:
Summary
Gets the set questions identified in 'id' and their answers.
Give it a try and retrieve all question bodies and answer details for the ids 751;1167;1803;1804 as (currently) returned by the search query above.
*Credits and answer format: systempuntoout
Not sure if this helps, but you can access the API using XML with a small utility I wrote.
See Stack2XML.