[thelist] REST RPC upload

Lee Kowalkowski lee.kowalkowski at googlemail.com
Wed Feb 10 16:45:31 CST 2010

On 10 February 2010 15:23, Bill Moseley <moseley at hank.org> wrote:
> No feedback here.  Was this too wordy/confusing?  Or does nobody have any
> suggestions for a REST/JSON API to support uploads?

Dunno, perhaps you're just ahead of the majority of us.  But if I were
to do it, I'm struggling to see where I'd anticipate having

I must admit I'm not seeing the attraction of using JSON in requests
(JSON in responses are fine for JS XHR),  Parsing JSON on the server
adds an unnecessary layer of processing in my opinion.  Serialising a
file upload and wrapping it with JSON means no easy browser
implementation unless I've misunderstood what you're trying to do,
which means you need specialised REST clients, I think ruling out a
cheap browser-based client means higher cost of testing.  Dunno,
perhaps you've got this already sorted.

As for REST-based API, if you're favouring a POST to a PUT, then you
should be posting to a URI which acts as a handler for the upload, and
the URI to access the new/modified resource would traditionally be a
subordinate of the POST URI.  E.g. posting to /images to create

People expect PUT implies that one must PUT directly to /images/foo,
but the server is allowed to choose a more suitable URI if necessary,
as long as it returns the alternative URI in the response.  PUT does
imply that the client is sending the entire representation of the
uploaded resource whereas POST does not (a POST may include the entire
representation, but doesn't have to).  Of course your
design/implementation is free to interpret requests however suits you


More information about the thelist mailing list