How to get JSON error response from ErpNext API?

Is there a way to tell the ErpNext REST API to return a JSON response when an error occurs?

I’ve been scrolling back and forth through reams of HTML to find error messages and it just occurred to me – “This isn’t even remotely normal! Since when does a computer to computer interface return a computer to human response to report an error?”


It’s an inconsistent design. That said, fixing it would require changing your file or changing the way that errors are handled in the front end of frappe.

That flag is set to False and is not available outside that function. It’s set another half dozen times below there as well.

1 Like

So it’s a candidate for a feature request in GitHub?


Yes, I would say so

Sorta what I thought, but …

… am I really the first to ask about this?

It’s quite an egregious breach of the REST “contract”, don’t you think?

nope: Not honoring accept-header when posting invalid JSON · Issue #6201 · frappe/frappe · GitHub

This is just a workaround, it doesn’t solve the issue. If the api consumer app can handle the response something like following can be done:


Any luck ?

Not so easy to solve, as you can read here.