[Mailman-Developers] REST API returns are plain text for errors, JSON or nothing for successful

Barry Warsaw barry at list.org
Sat Jan 10 19:39:23 CET 2015


On Jan 10, 2015, at 03:42 PM, Andrew Stuart wrote:

>Successful requests to the REST API return a 2xx HTTP code to indicate
>success either with or without JSON data depending on the context of the
>request.
>
>At least one (I’ve not checked the othes yet) 4xx error returned from the
>REST API returns a plain text error message rather than a JSON error message.
>
>For example attempting to create a domain that exists returns a 400 error
>with the response text “Domain exists”.
>
>Do you think this matters? Probably not much but does mean handling valid
>responses goes down a JSON path and handling error message goes down a plain
>text path. JSON error messages might arguable have been somewhat more
>consistent and programmable.

Some of this has to do with the historical legacy of the tools we've used to
implement the REST API (first, lazr.restful, then restish, and now hopefully
finally, falcon).  IIRC it wasn't possible to set a JSON body response on
error codes in lazr.restful and that just got inherited throughout the other
migrations.

I don't know if it matters.  I suppose we'll have to see what client authors
think.  Changing it would be an API change though, so perhaps we'd need to
wait until we rev the REST API.

Cheers,
-Barry


More information about the Mailman-Developers mailing list