doufen3563
2015-03-06 08:23
浏览 119

REST API中的PUT和DELETE

I have a question that still i have been using PUT and Delete in Web service (REST API) methods for respectively Update a resource and Delete a resource but i am informed now by mobile developers that its not good and always use POST method of HTTP to update and delete. Can i know how far is it true according to current world of technology ?

This is how i used.

Create -> Post
Read   -> Get
Update -> Put
Delete -> Delete

Suggest me the best API documentation that is available online with best practices.

图片转代码服务由CSDN问答提供 功能建议

我有一个问题仍然是我一直在使用PUT和Web服务中的删除(REST API)方法分别进行更新 一个资源和删除资源,但我现在被移动开发人员告知,它不好并始终使用HTTP的POST方法进行更新和删除。 根据当前的技术世界,我能知道它有多远吗?

这就是我使用的方式。

  Create  - > 发布
阅读 - > 获取
Update  - > 放
Delete  - > 删除
   
 
 

建议我使用最佳实践在线提供的最佳API文档。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dsmlf1207915 2015-03-06 08:29
    已采纳

    I think the problem is mostly related to some browsers or JavaScript frameworks not properly passing DELETE and PUT on Ajax calls.

    There's an overview of the --more or less-- current state for DELETE here:

    Are the PUT, DELETE, HEAD, etc methods available in most web browsers?

    and here (marked duplicate, but some different answers):

    Which browsers don't support a HTTP DELETE with jQuery.ajax?

    No mention of mobile browsers in particular, though.

    打赏 评论
  • dongyaoxiu6244 2015-03-06 08:32

    A lot of frameworks use a hidden input in a post request to tell the server what rest method it "really" is. Like this:

    <input type="hidden" name="_METHOD" value="PUT"/>
    
    打赏 评论

相关推荐 更多相似问题