tippenein/classroom_finder — pull request #26 by mikewadsten (2013-02-20 06:40:13+00:00)
Title: Add a RESTful JSON API.

##### Because this was me when I saw how we're generating the information on the site right now:
![...I was unhappy.](http://i.imgur.com/xlxIOp6.gif)

(Creating raw HTML and embedding it in the page with .innerHTML)

I will also be working on incorporating this API into a reworked front-end making use of AngularJS or a similar library as opposed to raw HTML and the use of the JavaScript innerHTML attribute.

#### How to use this

"Search" is accessible by sending a GET request to /search.json - returned will be a JSON list of gap info objects matching the request.

```javascript
[{"roomname": /* name */, "start": /* start time */,
"end": /* end time */, "length": /* gap length (integer) */,
"spaceID": /* spaceID used in spaceinfo.json request */
},
/* other rooms... */
]
```

"Space info" is accessible by sending a GET request to /spaceinfo.json - returned will be a JSON object corresponding to the spaceID given.

```javascript
{"room_url": /* OCM classroom page URL */,
"info": {
// object containing room information
// - chalk, capacity, room name, etc. etc.
// (This is the "info" object passed to the template, rendered as JSON)
}
}
```

Enjoy.