I'm trying to collect (SQL query, description) pairs for a project and the queries here https://data.stackexchange.com/stackoverflow/queries seem very useful. Is there any way to automatically retrieve them? (I can't seem to find them in the StackExchange dump https://archive.org/details/stackexchange)


No, there is no way to get all those queries automatically (and I doubt it is useful as a feature).

You could do the following:

  • make a HTTP GET request on http://data.stackexchange.com/stackoverflow/queries?order_by=everything. Get all the query links out and call them (on .title h3 a @href);
  • Determine the place the query is stored and retrieve the query from it (this is a little hard since it is formatted. You could take all the #text elements from inside queryBodyText). Or a better option: get the id from the link in the previous step, then call the fork URL (http://data.stackexchange.com/stackoverflow/query/fork/12345) and get the text from element with id sql;
  • Store the title and query in your own database or file.

You must log in to answer this question.

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