Jira REST API ignores Accept header when serving error responses

For several resources in the REST API, we see that response body contains HTML (html/text) rather than JSON (application/json) as requested by Accept header. Sometimes the resulting responses are quite large and seem to contain the usual Jira page, complete with scripts etc., even though all it could say is “401 Unauthorized” :slight_smile:

The resources for which we noticed this are:

  • /rest/api/2/search, status 502 and 403;
  • /rest/api/2/field, status 403;
  • /rest/atlassian-connect/1/addons/com.almworks.jira.structure, status 401;
  • once we got even text/plain response ( Sie sind nicht angemeldet. Authentifizierung ist erforderlich, um diesen Vorgang auszuführen.)

Reporting it here and not on DEVHELP as this is not critical, but it affects our operations since we have warnings about parse errors.


I second Igor - this is a real pain to handle, and impossible to parse reliably. All errors should be returned as JSON, never as HTML.


This still keeps happening. I’d like to hear someone from @Amber — should I raise this as a DEVHELP ticket? Judging by votes and replies, there are at least 5 other vendors with this problem.

Latest example: /rest/api/2/groupuserpicker, plain text response for 403 ( No se ha autenticado, se requiere estar autenticado para realizar esta operación. or You are not authenticated. Authentication required to perform this operation.)