Fix API to use JSON encoding for the body of non-GET requests

See 6c36487 for why.