【Rest】PUT Vs Post in Rest
what is rest
StackOverFlow上的關於Rest put 和post請求的討論
http://stackoverflow.com/questions/630453/put-vs-post-in-rest?rq=1
--來自stackOverFlow上的關於,post和put請求區別的一場討論
Use POST to create, and PUT to update. That's how Rails is doing it, anyway.
PUT /items/1 #=> update
POST /items #=> create
PUT:
PUT /resources/<existingResourceId> HTTP/1.1
PUT /resources/<newResourceId> HTTP/1.1
在原來resourceID下進行Put請求,就是對資源的更新
在新的資源ID下進行PUT請求,則是建立新的資源
POST
Create a new resource under the /resources URI, or collection. Usually the identifier is returned by the server.
--POST /resources HTTP/1.1
--POST在原來的資源ID下新增新的物件
網友的評論:
- PUT is not for update, it is for replace, note that to create you are replacing nothing with something. POST is absolutely not for update in any shape of form.
--POST is used to create.
--PUT is used to create or update.
- Both PUT and POST can be used for creating.
相關文章
- 【譯】GraphQL vs. RESTREST
- GraphQL API vs REST APIAPIREST
- REST is not enabled. use -rest to turn onREST
- Web Service實踐之REST vs RPCWebRESTRPC
- Rest Post示例(java服務端、python客戶端)RESTJava服務端Python客戶端
- REST APIsRESTAPI
- rest apiRESTAPI
- The REST ObjectionRESTObject
- REST真相REST
- 到底什麼樣的 REST 才是最佳 REST?REST
- SOA之(5)——REST的SOA(SOA with REST)概念REST
- What is the difference Put and Post and Get?
- REST : rest_framework.decorators.api_view 實現PATCHRESTFrameworkAPIView
- REST StreamingREST
- Rest-AssuredREST
- WCF Rest ServiceREST
- 淺談RESTREST
- 關於RESTREST
- SharePoint REST API - 確定REST端點URLRESTAPI
- Elasticsearch(二)——Rest APIElasticsearchRESTAPI
- `rest-client`庫RESTclient
- 什麼是restREST
- Spark REST API & metricsSparkRESTAPI
- django rest framework(4)DjangoRESTFramework
- Rest--入門REST
- 對 REST 的理解REST
- 什麼是REST?REST
- It's not just a place to restREST
- 示例:建立REST SOEREST
- REST framework:介面文件RESTFramework
- REST framework:分頁RESTFramework
- http REST 簡介HTTPREST
- 基於libcurl實現REST風格http/https的get和postRESTHTTP
- Django REST framework 分頁DjangoRESTFramework
- day49-rest框架REST框架
- Rest 風格說明REST
- Clean architecture for the rest of usREST
- dubbox rest服務REST