Loading ...
Sorry, an error occurred while loading the content.

5834Re: [rest-discuss] RESTful representation of side effects?

Expand Messages
  • Roy T. Fielding
    Apr 5, 2006
      Hi Ernie,

      > I want to provide a web service that, say, converts HTML documents
      > into various formats. The naive RPC method would seem to be to
      > create a special URL string for each type, e.g.:
      > /convert.cgi?format=pdf&document=mydocument.html
      > /convert.cgi?format=doc&document=mydocument.html
      > etc.

      That is confusing. Why "document=mydocument.html"? Is the server
      translating the input file or is it getting the file from somewhere
      else? I could understand a gateway form like


      OTOH, a translation service like


      can simply be a POST of file-upload with the response being the
      converted representation.

      > However, that doesn't seem very RESTful.

      Why? POST is RESTful too, when it is used correctly.

      > I would imagine the RESTful
      > alternative would be to:
      > a) PUT the initial resource; get a URL back
      > b) <do something to that URL>
      > c) Return the URL describing that resource
      > d) GET the final resource
      > But, if so, I can't figure out the RESTful way to do (b). Is there?

      That would only make sense if you want the document to be stored
      as a new resource that is available from then on, and the converted
      forms are available via different links and/or negotiation.
      In that case, you want the Alternates header field, though similar
      functionality can be accomplished within the body of a 201 response.

      It is relatively easy to create an HTTP server module that
      provides content-conversion on the fly for anything stored within
      the system. It then becomes a resource discovery problem (how does
      the client know where to obtain all of these other formats?), which
      is what Alternates or Link was intended to supply.

    • Show all 12 messages in this topic