API accepts json instead of post forms

When AngularJS does an http post request, it sends
the post parameters as a json body. Instead of
fighting with AngularJS to send a post request with
query parameters or form parameters, this patch
changes the api to accept json instead.