3

About

After the JSON documentation for the Stack Exchange API was dropped for v2.0, I began to wonder if it would be possible to throw together a PHP script that did a bit of screen-scraping to generate a JSON map of the API. Thus, Stack Cartographer was born.

This small PHP script downloads each page of the API docs (well, most of them anyway) and parses the HTML returned - scraping information about each method such as path, parameters, etc. The script is still in its early stages so there is still a lot of information it doesn't return yet.

This script is designed to be nice to the Stack Exchange servers, limiting page requests to 2 req. / sec. You are strongly encouraged to avoid excessive use of Stack Cartographer since it fetches about 83 pages (at the time of writing). Once the map is generated, you'll never need to generate it again unless the API changes.

Sample Output

{
  "meta": {
    "generator": "Stack Cartographer 0.1",
    "date": "Saturday, 24-Mar-12 11:28:46 PDT"
  },
  "methods": [
    {
      "path": "\/answers",
      "description": "Returns all the undeleted answers in the system.",
      "parameters": {
        "page": "number",
        "pagesize": "number",
        ...

License

Stack Cartographer is released under the MIT License.

Contact

I can be reached at [email protected].

Code

Stack Cartographer is written in PHP.

The code can be retrieved from here:
https://github.com/nathan-osman/Stack-Cartographer

0

You must log in to answer this question.

Browse other questions tagged .