error messageing and formating for json xml html and plain response on api