http-delete

Deleting a resource using http DELETE

橙三吉。 提交于 2019-11-28 03:07:30
So, given that the DELETE verb in Http is idempotent, when I issue the following request, what should happen the second (or third, or fourth, etc...)? DELETE /person/123 The first time, the resource is deleted and I return a 204 (successful, no content). Should I return a 204 on subsequent calls or a 404 (not found)? As HTTP requests in a stateless system should be independent, the results of one request should not be dependent on a previous request. Consider what should happen if two users did a DELETE on the same resource simultaneously. It makes sense for the second request to get a 404.

How to make Apache Tomcat accept DELETE method

早过忘川 提交于 2019-11-27 22:17:37
I'm working on a project of RESTful web services, i'm using Apache Tomcat and JAX-RS. I want to accept DELETE requests from client but whenever i send a DELETE request from Advanced REST client Chrome plugin it gives response code 403 Forbidden. So how can i make Apche Tomcat accept DELETE request? Tomcat was blocking DELETE methods for me because of my CORS filters. I needed new filters registered in my web.xml file. Here's an example of a very permissive one: <filter> <filter-name>CorsFilter</filter-name> <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> <init-param> <param

Slim Framework - jQuery $.ajax request - Method DELETE is not allowed by Access-Control-Allow-Methods

一曲冷凌霜 提交于 2019-11-27 18:41:48
问题 I am trying to use a REST API written in Slim Framework. Get & Post methods work without any problem. But DELETE requests doesn't work. I get " Method DELETE is not allowed by Access-Control-Allow-Methods " I have already allowed OPTIONS aswell as DELETE in headers. See code below. header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: Content-Type'); header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS'); $app->options('/(:name+)', function() use(

Retrofit throwing IllegalArgumentException exception for asynchronous FormUrlEncoded DELETE call

末鹿安然 提交于 2019-11-27 17:48:45
问题 I'm trying to make an asynchronous POST and DELETE which is form url encoded using Retrofit in Android 4.4 Here is my client - @FormUrlEncoded @POST(INetwork.API_BASE_PREFIX + "/memberships.json") void join(@Field("id") String id, Callback<?> cb); @FormUrlEncoded @DELETE(INetwork.API_BASE_PREFIX + "/memberships.json") void leave(@Field("id") String id, Callback<?> cb); And this is the exception - java.lang.IllegalArgumentException: IRepositoryClient.leave: FormUrlEncoded can only be specified

How can I send a http delete request from browser?

偶尔善良 提交于 2019-11-27 17:26:05
问题 Is there a way to send a DELETE request from a website, using xmlhttprequest or something similar? 回答1: As someone mentioned above, jQuery will do this for you, via the following syntax: $.ajax({ type: "DELETE", url: "delete_script.php", data: "name=someValue", success: function(msg){ alert("Data Deleted: " + msg); } }); 回答2: You can test if your browse has DELETE implemented here Supposing req is a XMLHttpRequest object, the code would be req.open("DELETE", uri, false) ; 回答3: This can be

What REST PUT/POST/DELETE calls should return by a convention?

空扰寡人 提交于 2019-11-27 16:49:58
According to the "REST ideology" what should be in the response body for a PUT/POST/DELETE requests? What about return codes? Is HTTP_OK enough? What is the reason for such conventions, if any? I've found a good post describing POST/PUT differences: POST vs PUT But it still doesn't answer my question. Darrel Miller Forgive the flippancy, but if you are doing REST over HTTP then RFC7231 describes exactly what behaviour is expected from GET, PUT, POST and DELETE. Update (Jul 3 '14): The HTTP spec intentionally does not define what is returned from POST or DELETE. The spec only defines what needs

How to delete SOLR indexed data by query with curl?

╄→гoц情女王★ 提交于 2019-11-27 14:37:51
问题 I have a SOLR schema.xml like this: <field name="cartype" type="lowercase" indexed="true" stored="true"/> <field name="color" type="lowercase" indexed="true" stored="true"/> I want to delete "blue" and "stationwagon" tagged records from SOLR database with a curl command. But I didn't do that with following command : curl http://46.231.77.98:7979/solr/update/?commit=true -H "Content-Type: text/xml" -d "<delete>(cartype:stationwagon)AND(color:blue)</delete>" Do you have any suggestions? 回答1:

Javascript: Fetch DELETE and PUT requests

时间秒杀一切 提交于 2019-11-27 14:29:12
问题 I have gotten outside of GET and POST methods with Fetch. But I couldn't find any good DELETE and PUT example. So, I ask you for it. Could you give a good example of DELETE and PUT methods with fetch. And explain it a little bit. 回答1: Here is a fetch POST example. You can do the same for DELETE . function createNewProfile(profile) { const formData = new FormData(); formData.append('first_name', profile.firstName); formData.append('last_name', profile.lastName); formData.append('email',

Body of Http.DELETE request in Angular2

笑着哭i 提交于 2019-11-27 11:01:50
I'm trying to talk to a somewhat RESTful API from an Angular 2 frontend. To remove some item from a collection, I need to send some other data in addition to the removée unique id(that can be appended to the url), namely an authentication token, some collection info and some ancilliary data. The most straightforward way I've found to do so is putting the authentication token in the request Headers, and other data in the body. However, the Http module of Angular 2 doesn't quite approve of a DELETE request with a body, and trying to make this request let headers= new Headers(); headers.append(

HTTP protocol's PUT and DELETE and their usage in PHP

倖福魔咒の 提交于 2019-11-27 11:01:32
Introduction I've read the following: Hypertext Transfer Protocol (HTTP) is the life of the web. It's used every time you transfer a document, or make an AJAX request. But HTTP is surprisingly a relative unknown among some web developers. The HTTP verbs comprise a major portion of our “uniform interface” constraint and provide us the action counterpart to the noun-based resource. The primary or most-commonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT , and DELETE . Huh? Well, we came to the point I lost track of things. PUT and DELETE , they say. I've only