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

Andrew Stuart andrew.stuart at supercoders.com.au
Sat Jan 10 20:06:41 CET 2015


I don’t think it’s a big deal in the short term because the plain text error message can easily be read from the response.

The only thing that’s somewhat odd is that the content-type is application/json even though the content isn’t (for error messages).


On 11 Jan 2015, at 5:39 am, Barry Warsaw <barry at list.org> wrote:

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
_______________________________________________
Mailman-Developers mailing list
Mailman-Developers at python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: https://mail.python.org/mailman/options/mailman-developers/andrew.stuart%40supercoders.com.au

Security Policy: http://wiki.list.org/x/QIA9



More information about the Mailman-Developers mailing list