http-method

What is difference between HTTP methods GET, POST, PUT and DELETE

[亡魂溺海] 提交于 2019-11-26 19:02:07
问题 I am developing REST WCF service and As theoretically i know when to opt for what purpose. GET to get the resource PUT to update POST to Insert DELETE to delete But what is the disadvantage if we don't follow this above rule, suppose to insert a record i used GET method? 回答1: Because the HTTP GET method is specified as idempotent, a GET request, by specification, can be resubmitted with the assumption that it will not change anything on the server. This is not the case for a HTTP POST which

curl -GET and -X GET

久未见 提交于 2019-11-26 17:56:21
问题 Curl offers a series of different http method calls that are prefixed with a X, but also offers the same methods without. I've tried both and I can't seem to figure out the difference. Can someone explain to me quickly how these two operations differ? 回答1: By default you use curl without explicitly saying which request method to use. If you just pass in a HTTP URL like curl http://example.com it will use GET. If you use -d or -F curl will use POST, -I will cause a HEAD and -T will make it a

Should I use PATCH or PUT in my REST API?

坚强是说给别人听的谎言 提交于 2019-11-26 14:58:07
问题 I want to design my rest endpoint with the appropriate method for the following scenario. There is a group. Each group has a status. The group can be activated or inactivated by the admin. Should I design my end point as PUT /groups/api/v1/groups/{group id}/status/activate OR PATCH /groups/api/v1/groups/{group id} with request body like {action:activate|deactivate} 回答1: The PATCH method is the correct choice here as you're updating an existing resource - the group ID. PUT should only be used

Which HTTP methods match up to which CRUD methods?

我们两清 提交于 2019-11-26 06:10:03
问题 In RESTful style programming, we should use HTTP methods as our building blocks. I\'m a little confused though which methods match up to the classic CRUD methods. GET/Read and DELETE/Delete are obvious enough. However, what is the difference between PUT/POST? Do they match one to one with Create and Update? 回答1: Create = PUT with a new URI POST to a base URI returning a newly created URI Read = GET Update = PUT with an existing URI Delete = DELETE PUT can map to both Create and Update

When should I use GET or POST method? What's the difference between them?

微笑、不失礼 提交于 2019-11-25 21:46:34
问题 What\'s the difference when using GET or POST method? Which one is more secure? What are (dis)advantages of each of them? (similar question) 回答1: It's not a matter of security. The HTTP protocol defines GET-type requests as being idempotent, while POSTs may have side effects. In plain English, that means that GET is used for viewing something, without changing it, while POST is used for changing something. For example, a search page should use GET, while a form that changes your password