repos - Quelle est la différence entre POST et PUT dans HTTP

Mots clés : httprestpostputhttp

meilleur 3 Réponses repos - Quelle est la différence entre POST et PUT dans HTTP

vote vote

97

POST /questions/<existing_question> HTTP/1.1 Host: www.example.com/ 
POST /questions/<new_question> HTTP/1.1 Host: www.example.com/ 
POST /questions HTTP/1.1 Host: www.example.com/ 
PUT /questions/<new_question> HTTP/1.1 Host: www.example.com/ 
PUT /questions/<existing_question> HTTP/1.1 Host: www.example.com/ 
vote vote

89

POST /expense-report 
PUT  /expense-report/10929 
vote vote

74

PUT /resources/<newResourceId> HTTP/1.1  
POST /resources HTTP/1.1 
PUT /resources/<existingResourceId> HTTP/1.1 
URI: website.com/users/john website.com  - whole site users        - collection of users john         - item of the collection, or a resource  URI:website.com/users/john/posts/23 website.com  - whole site users        - collection of users john         - item of the collection, or a resource posts        - collection of posts from john 23           - post from john with identifier 23, also a resource 
POST /users HTTP/1.1 
POST /users/john HTTP/1.1 
PUT /users/john HTTP/1.1 

Questions similaires