wri/gfw-api — pull request #17 by eightysteele (2013-11-28 04:23:45+00:00)
Title: WIP: For #16 with pubsub support for forma data

WIP WIP WIP Not ready for merge yet.

@matallo @d4weed Basic pubsub stuff to support subscribing to data changes via the GFW website. It's super general. You can subscribe to a topic, publish a topic, and unsubscribe from a topic. :D

Now for security these API calls require POST with an authorization token. From the GFW site it would probably just need to be proxied through the server so that it could make requests with the token maybe? I'll email you guys the token.

Subscribe to the `updates/forma` topic for monthly FORMA updates in Brazil:

```bash
$ curl -i -d '{"topic": "updates/forma", "iso": "bra", "email": "eightysteele@gmail.com", "token":"PUBSUB_TOKEN"}' http://wip.gfw-apis.appspot.com/subscribe
```

Publish the `updates/forma` topic (results in all subscribers getting notified via email):

```bash
$ curl -i -d '{"topic": "updates/forma", "token":"PUBSUB_TOKEN"}' http://wip.gfw-apis.appspot.com/publish
```

Unsubscribe from `updates/forma` topic:

```bash
$ curl -i -d '{"topic": "updates/forma", "email": "eightysteele@gmail.com", "token":"PUBSUB_TOKEN"}' http://wip.gfw-apis.appspot.com/unsubscribe
```