toolness / hive-django

A Django-based Hive website for member organizations, their employees, and other community members.
https://directory.hivelearningnetworks.org
1 stars 10 forks source link

Add a simple anonymous API to retrieve member org info #34

Closed toolness closed 10 years ago

toolness commented 10 years ago

Hive NYC would like the current member list on their Wordpress-based website to be pulled directly from the directory, so they don't have to maintain it in two separate places.

One way to support this is to add a simple API endpoint, e.g.:

GET /api/v1/cities/:city/members

This could return a JSON response such as:

[
            {"name": "American Museum of Natural History",
             "website": "http://www.amnh.org/"},
            {"name": "WNYC's Radio Rookies",
             "website": "http://www.radiorookies.org/"}
]

A simple WordPress plugin or JS include on the Hive NYC site could then grab this JSON and drop it into a template.

Note that there is currently a JSON endpoint at /find.json, but this is a private API, in that it's used by Ajax code on the directory search page, and uses the current user's session cookie for authentication. Everything under the /api/ endpoint, in contrast, will be for external clients like the Hive NYC wordpress site. If and when we offer privileged data through this API, requests will probably be authenticated through OAuth or somesuch, as opposed to session cookie.

toolness commented 10 years ago

Merging this in now, and filing #38 to be completed later.