Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With POST you're creating a resource within the resource identified by the Request-URI. The server is responsible for creating a URI for the new resource you created.

    POST /forum/http/
    
     - creates a new post into the HTTP forum

    POST /photogalleries/cats/

     - uploads a new photo into the cats photo gallery
With PUT the client knows the resource's URI. The client uses it to create or update the resource. The easiest why to visualize this is to think of a filesystem

   PUT /forum/http/post-vs-put

    - upserts a post identified by "post-vs-put" into the HTTP forum

   PUT /photogalleries/cats/smelly-cat

    - upserts a photo identified by "smelly-cat" into the cat's photo gallery.


To be precise, there's really nothing that you can determine from the resource you're POSTing to. A POST to /forum/http/ could create a new cat picture in /yaykittens/ for all we know.

It's meant to be a catchall method, used for anything the others don't specifically cover.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: