Tidy up REST interface

 - Ensure application/json where appropriate
 - Use jquery api rather than d3