Barton

Barton is programmable, political access. It's an API for Australian electorate and politician contact details.

Access

Access the API via HTTP:

curl http://barton.experimentsindemocracy.org/api

Or download and install it yourself:

$ gem install barton
$ barton --setup
$ barton

Requests

NOTE: Barton is in a very early alpha stage and the API may change substantially. Ensure you use the email param to get notifications of any changes.

The API base with examples can be found at:

http://barton.experimentsindemocracy.org/api

Subsequent use takes the form:

/resource/[id]?[params]

To return a single electorate

/electorates/id

To return multiple electorates

/electorates?params=values

Address returns all electorates bounding the supplied address. Where ever possible, do the geocoding yourself to avoid Google's 2500 per day rate limit.

/electorates?address=676+Ann+St,+Fortitude+Valley+Qld+4006 

Geo returns all electorates bounding the supplied 'long,lat' string. Using geo instead of address will result in better results.

/electorates?geo=145.77602080,-16.92192860

Tags returns all electorates matching the comma separated tags. To find all local councils and wards in Sydney for example:

/electorates?tags=sydney,local

Or get more cunning with key:value and splat tags for all Mayors in Queensland whose name that start with the letter 'G'

/electorates?tags=name:g*,queensland,mayor

Go totally freaky by mixing tags and geo. Try all politicians responsible for transport in Cairns

/electorates?geo=145.77602080,-16.92192860&tags=transport

Finally, add your email so I can keep a handle on usage and loads

/[email protected]

Responses

Barton will try to play HATEOAS as nicely as possible so you should be able to explore from the base api url to all resources. Responses are will be in JSON format and limited to 100 results.

/electorates?tags=name:sydney,local

{
  "name": "Barton API",
  "result_count": 3,
  "results": [
    {
      "name": "Sydney",
      "tags": [
        "New South Wales",
        "Local",
        "Ward",
        "Eastern Suburbs"
      ],
      "id": "1623a1"
    },
    {
      "name": "Sydney",
      "tags": [
        "New South Wales",
        "Local",
        "LGA",
        "Eastern Suburbs"
      ],
      "id": "164e15"
    },
    {
      "name": "North Sydney",
      "tags": [
        "New South Wales",
        "Local",
        "LGA",
        "Lower North Shore"
      ],
      "id": "7b971f"
    }
  ],
  "resources": {
    "home": "http://barton.experimentsindemocracy.org",
    "api": "http://barton.experimentsindemocracy.org/api",
    "electorates": "http://barton.experimentsindemocracy.org/api/electorates"
  },
  "examples": {
    "electorates": {
      "resource_id": "http://barton.experimentsindemocracy.org/api/electorates/ccbfd1",
      "geo": "http://barton.experimentsindemocracy.org/api/electorates?geo=151.2054563,-33.8438383",
      "tags": "http://barton.experimentsindemocracy.org/api/electorates?tags=sydney,jurisidction:local",
      "mixed": "http://barton.experimentsindemocracy.org/api/electorates?geo=151.2054563,-33.8438383&tags=federal"
    }
  }
}

Contributing

If you want to help then by all means jump in, fork and push a pull request.

Updating politician contact details is the most pressing job. See the data readme for more details.