http-delete

Retrofit 2.0 how to delete?

浪尽此生 提交于 2019-12-10 12:34:51
问题 I am using retrofit 2.0 and I am implementing a delete feature in my Android app, however, I cannot make it successfully, can someone give me a suggestion? I tried both: @DELETE("books/{id}") void deleteBook(@Path("id") int itemId); @DELETE("books/{id}") void deleteBook(@Path("id") int bookId, Callback<Response> callback); I get error java.lang.IllegalArgumentException: Service methods cannot return void. for method LibraryService.deleteBook. I also gave a try on this: Response deleteBook(

Which HTTP status code to return when the DELETE operation is not allowed for particular reason

谁都会走 提交于 2019-12-09 14:19:45
问题 Assume that I have a resource (e.g: /api/shipments/100 ) which supports HTTP DELETE method. As you can understand from the URI itself, if a DELETE request is made against this URI, this resource will be removed. In my current scenario, the DELETE request can only be performed successfully if a certain condition is met as below: If the shipment state is not set to InTransit or Delivered. If there is a DELETE request against that URI and the above condition is not met, which HTTP status code

github v3 API - delete / remove a repo

老子叫甜甜 提交于 2019-12-09 07:01:44
问题 I would like to programmatically delete a github repo, when setting up a unit test environment for my application. I am already using the v3 API, which seems to be most supported and the path going forward. I am using the following python lines to successfully CREATE a repo, just fine: import urllib2, base64 createData = '{\"name\": \"UnitTest-SubModules\", \"description\": \"This is a Fake repo used for testing\"}' request = urllib2.Request("https://api.github.com/user/repos") base64string =

ExpressJS - res.redirect after DELETE request

允我心安 提交于 2019-12-08 15:09:47
问题 I have been searching all over for how to do this - I am trying to redirect after a DELETE request is made - here is the code I am using WITHOUT THE REDIRECT : exports.remove = function(req, res) { var postId = req.params.id; Post.remove({ _id: postId }, function(err) { if (!err) { console.log('notification!'); res.send(200); } else { console.log('error in the remove function'); res.send(400); } }); }; remove gets called when an item (a post) is deleted. Everything works fine (I had to use

Problems doing a proper HTTP Delete with Ajax.ActionLink

喜你入骨 提交于 2019-12-07 03:23:53
问题 What i'm trying to do: Try to delete a record using a "proper" HTTP Delete. Controller Code: [HttpDelete] public void DeleteRun(int RunId) { repository.RemoveEntry(RunId); } Razor View: @Ajax.ActionLink("Delete","DeleteRun",new {RunId = run.RunId}, new AjaxOptions() { Confirm = "Are you sure you want to delete this entry?", HttpMethod = "DELETE", OnComplete = string.Format("DeleteRunInTable({0})",run.RunId) }) Javascript (in separate included file): function DeleteRunInTable(RunId) { $("tr

Is it okay to use an HTTP DELETE to deactivate a record?

*爱你&永不变心* 提交于 2019-12-06 19:54:33
问题 I'm building a RESTful API command to deactivate a user record. Is it kosher to use DELETE to do this or should this be a PUT, since the record is being updated to "deactivated" status? Or is it just a matter of taste? 回答1: The semantics of DELETE means that you are actually getting rid of the object. What you're doing here seems like a modification of the object's state. In this case a PUT or PATCH would be more appropriate. It is better to stick with the semantics of uniform interface that

Sending PUT/DELETE data with a XMLHttpRequest

谁说胖子不能爱 提交于 2019-12-06 18:06:28
问题 I used the example from Send POST data using XMLHttpRequest to create this JavaScript code: function PostXML(webURL, post_data) { var objHTTP = new ActiveXObject("MSXML2.XMLHTTP"); objHTTP.open("POST", webURL, false); objHTTP.setRequestHeader("Content-Type", "application/xml; charset=utf-8"); objHTTP.setRequestHeader("Accept", "application/xml; charset=utf-8"); objHTTP.setRequestHeader("Content-Length", post_data.length); objHTTP.send(post_data); while((objHTTP.readyState != 4) && (objHTTP

HTTP PUT, DELETE and I/O streams with PHP

我是研究僧i 提交于 2019-12-05 17:00:17
Is there any way I can access data that was sent via HTTP PUT method other than $putdata = fopen("php://input", "r"); ? I have never worked with PUT and DELETE methods and $putdata = fopen("php://input", "r"); seems a bit sketchy. Will it work everywhere is a specific server/php.ini configuration required? I know that I can get the request method from $_SERVER['REQUEST_METHOD']; But will the data be in $_REQUEST , if yes then what php://input is about? And how do I access data that was sent via DELETE ? No, you will need to parse the request manually. $_REQUEST only contains data coming from

Problems doing a proper HTTP Delete with Ajax.ActionLink

淺唱寂寞╮ 提交于 2019-12-05 08:15:28
What i'm trying to do: Try to delete a record using a "proper" HTTP Delete. Controller Code: [HttpDelete] public void DeleteRun(int RunId) { repository.RemoveEntry(RunId); } Razor View: @Ajax.ActionLink("Delete","DeleteRun",new {RunId = run.RunId}, new AjaxOptions() { Confirm = "Are you sure you want to delete this entry?", HttpMethod = "DELETE", OnComplete = string.Format("DeleteRunInTable({0})",run.RunId) }) Javascript (in separate included file): function DeleteRunInTable(RunId) { $("tr[data-runid=" + RunId).remove(); } Link the actionlink method is creating: <a data-ajax="true" data-ajax

REST - revertable DELETE

不打扰是莪最后的温柔 提交于 2019-12-05 03:08:47
I have a question about HTTP DELETE and REST. I have a resource x . Depending on the state of x , deletion of x does either: Delete x permanently. Mark x as deleted. This means that x can reverted later on. I assume that HTTP DELETE must delete the resource according to the HTTP/REST specifics, instead of marking it as deleted, for example: GET on x must return 404 after the HTTP DELETE has been processed. This means that HTTP DELETE cannot be used for the second situation. How would you model this delete behaviour (both 1 and 2) in a RESTful way? Then, since some resources can be reverted,