DELETE是一种HTTP请求方法,用于删除服务器端的指定资源。
我有一个 ASP.NET MVC 应用程序。 我有单个函数模式,将通过 HTTP POST 和 HTTP DELETE 调用。 尽管调用了 Post,但从未调用过删除。我确认 IIS 接受...
我正在构建一个 RESTful API 命令来停用用户记录。使用 DELETE 来执行此操作是否符合规定,或者应该将其作为 PUT,因为记录正在更新为“已停用”状态?或者是...
我有一个 Express 服务器,其中包含删除(心理学)实验的路线。 (我已将路线分成多个文件。该路线位于 admin.js 中,因此其完整路线路径是 /admin/experimen...
我一直在为我的 Spring Boot 尝试 CRUD 操作。 我必须在 delete() 方法中按给定名称删除行。我需要一些指导才能使其正常工作。我调试了代码,但它返回 500 err...
如何在bash中使用REST API删除Azure存储队列上的消息?
我想知道如何删除Azure存储队列上的消息。目前我不断收到以下错误。 我想知道如何删除Azure存储队列上的消息。目前我不断收到以下错误。 <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:47de86b5-3003-004d-0fc0-dd56e6000000 Time:2024-07-24T11:56:26.1466778Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request '<signature>' is not the same as any computed signature. Server used following string to sign: 'DELETE x-ms-date:Wed, 24 Jul 2024 11:56:25 GMT x-ms-version:2016-05-31 /gildedhonordev/ghmatchedtickets/messages/<messageid>'.</AuthenticationErrorDetail></Error> 使用此页面作为指导,我创建了一个成功获取排队消息的函数。然而,当我想删除一条消息时,同样的方法在授权时总是失败。 以下是我的代码: get_queued_message() { DATE_ISO=$(TZ=GMT date "+%a, %d %h %Y %H:%M:%S %Z") VERSION="2016-05-31" HEADER_RESOURCE="x-ms-date:$DATE_ISO\nx-ms-version:$VERSION" URL_RESOURCE="/$STORAGE_ACC/$QUEUE_NAME/messages" STRING_TO_SIGN="GET\n\n\n\n\n\n\n\n\n\n\n\n$HEADER_RESOURCE\n$URL_RESOURCE" DECODED_KEY="$(echo -n "$STORAGE_KEY" | base64 -d -w0 | xxd -p -c256)" SIGN=$(printf "$STRING_TO_SIGN" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$DECODED_KEY" -binary | base64 -w0) RET=$(curl -X GET \ -H "x-ms-date:$DATE_ISO" \ -H "x-ms-version:$VERSION" \ -H "Authorization: SharedKey $STORAGE_ACC:$SIGN" \ -H "Content-Length:0" \ "https://$STORAGE_ACC.queue.core.windows.net/$QUEUE_NAME/messages") MESSAGE=$(echo "$RET" | grep -oP '<MessageText>\K[^<]+') MESSAGE_ID=$(echo "$RET" | grep -oP '<MessageId>\K[^<]+') POP_RECEIPT=$(echo "$RET" | grep -oP '<PopReceipt>\K[^<]+') } delete_queued_message() { DATE_ISO=$(TZ=GMT date "+%a, %d %h %Y %H:%M:%S %Z") VERSION="2016-05-31" HEADER_RESOURCE="x-ms-date:$DATE_ISO\nx-ms-version:$VERSION" URL_RESOURCE="/$STORAGE_ACC/$QUEUE_NAME/messages/$MESSAGE_ID?popreceipt=$POP_RECEIPT" STRING_TO_SIGN="DELETE\n\n\n\n\n\n\n\n\n\n\n\n$HEADER_RESOURCE\n$URL_RESOURCE" DECODED_KEY="$(echo -n "$STORAGE_KEY" | base64 -d -w0 | xxd -p -c256)" SIGN=$(printf "$STRING_TO_SIGN" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$DECODED_KEY" -binary | base64 -w0) curl -X DELETE \ -H "x-ms-date:$DATE_ISO" \ -H "x-ms-version:$VERSION" \ -H "Authorization: SharedKey $STORAGE_ACC:$SIGN" \ "https://$STORAGE_ACC.queue.core.windows.net/$QUEUE_NAME/messages/$MESSAGE_ID?popreceipt=$POP_RECEIPT" } 如有任何帮助,我们将不胜感激 如何在 bash 中使用 REST API 删除 Azure 存储队列上的消息? 您可以使用以下脚本来使用 Bash Delete Azure Storage Queue message。 脚本: #!/bin/bash # Function to convert base64 to hex base64_to_hex() { echo -n "$1" | base64 --decode | od -An -tx1 | tr -d ' \n' } # Function to delete the queued message delete_queued_message() { STORAGE_ACC=$1 STORAGE_KEY=$2 QUEUE_NAME=$3 MESSAGE_ID=$4 POP_RECEIPT=$5 DATE_ISO=$(TZ=GMT date "+%a, %d %h %Y %H:%M:%S %Z") VERSION="2020-04-08" HEADER_RESOURCE="x-ms-date:$DATE_ISO\nx-ms-version:$VERSION" CANONICALIZED_RESOURCE="/$STORAGE_ACC/$QUEUE_NAME/messages/$MESSAGE_ID\npopreceipt:$POP_RECEIPT" STRING_TO_SIGN="DELETE\n\n\n\n\n\n\n\n\n\n\n\n$HEADER_RESOURCE\n$CANONICALIZED_RESOURCE" DECODED_KEY=$(base64_to_hex "$STORAGE_KEY") SIGN=$(printf "$STRING_TO_SIGN" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$DECODED_KEY" -binary | base64) curl -X DELETE \ -H "x-ms-date:$DATE_ISO" \ -H "x-ms-version:$VERSION" \ -H "Authorization: SharedKey $STORAGE_ACC:$SIGN" \ "https://$STORAGE_ACC.queue.core.windows.net/$QUEUE_NAME/messages/$MESSAGE_ID?popreceipt=$POP_RECEIPT" } STORAGE_ACC="venkat326123" STORAGE_KEY="T3czZpu1gZzzzzzzztD9nyWw==" QUEUE_NAME="queue1" MESSAGE_ID="aeacazzzzzf6914a" POP_RECEIPT="AgAzzzAAAA09p8nc3d2gE=" delete_queued_message $STORAGE_ACC $STORAGE_KEY $QUEUE_NAME $MESSAGE_ID $POP_RECEIPT 上面的脚本在我的环境中执行并删除了 azure 队列消息。 传送门: 参考: 删除消息(REST API)- Azure 存储 |微软学习
有没有办法使用 xmlhttprequest 或类似的东西从网站发送 DELETE 请求?
放置和删除方法适用于集成管道模式,但不适用于我的服务器上的经典模式
我有一个Web API应用程序,当部署在IIS服务器中时,单独的PUT和DELETE方法不起作用。但在本地运行良好。 当我尝试对各种选项(例如禁用)进行更多调查时...
当我使用HTTP的delete协议在body中传递参数时(参数很小),nginx返回413,为什么?
像这样: [root@localhost orz]# [root@localhost orz]# [root@localhost orz]#curl -X 'DELETE' 'http://192.168.6.166:7777/api/services/group/' -H '接受:application/json' -H '授权:
要对当前会话执行此操作,您可以执行以下操作: PUT _cluster/设置 { “短暂的”: { "action.delta_requires_name": false } } ...之后我可以做
HTTP PATCH 和 DELETE 请求在 EJS 项目中不起作用
我无法让这些 PATCH 和 DELETE 请求发挥作用。我尝试了很多不同的事情,PATCH 请求当前返回“Cannot GET /edit/save/1”,而 DELETE 请求返回“Can...
编辑帖子和标题,因为删除不起作用。 ''' def 删除(): 返回错误 ''' 我认为这个网站已经损坏,因为当我尝试删除帖子时,他们有这样的功能。
无法将 JSON 值转换为 HttpDelete 响应中的类列表
使用.Net Core我开发了一个HttpDelete控制器 [HttpDelete("dqc")] [允许匿名] 公共异步任务DeleteDQCAsync([FromBody]IEnumerabledqcs,
为什么有些服务器不接受HTTP DELETE中的body参数?
我实际上遇到了这个问题,当我测试一个API时,它不接受带有主体参数的HTTP DELETE,但接受查询参数。 这很好,但我不相信为什么身体
我正在使用 Modeshape 休息服务器。 Modeshape的版本是2.8.2。 当我向 http://localhost:8080/modeshape-server/repo/workspace1/items/file 等节点发送 GET 请求时,它会返回信息 abo...
在启用 no-cors 的情况下使用 Fetch api DELETE 方法
我正在尝试发出删除后端实体的 API 请求。我的 spring 服务器和 node.js 服务器在不同的端口上运行。 当我在启用 cors 的情况下尝试提取请求时(模式:&q...
我想通过删除所有用户来有效地“重置”用于测试目的的 Auth0 租户之一。 根据社区论坛,似乎没有办法做到这一点。 正在删除...
遇到内部服务器错误 - 如何在我的 Web 应用程序中排查并解决此问题?
App.jsx:39 删除餐厅时出错。服务器返回 500 内部服务器错误 我正在构建一个使用 Flask 后端 API 的 React 应用程序,当我尝试从前端删除时,它会保留...
我的后端是 NodeJs 和 Express。我的 90% 的端点都经过 validateToken 中间件并且运行良好,但我创建了一个删除端点,由于某种原因它没有得到
当我使用Javascript单击删除按钮时,如何从DOM中删除TODO项目列表?
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>TODO app</title> </head> <script> function deleteDone(id) { console.log("Deleted todo ID:", id); // Delete the right todo from the list // You will need to give each todo an id, and that should be enough to remove it } function deleteTodo(id) { fetch("http://localhost:3000/todos/" + id, { method: "DELETE", headers: { "Content-Type": "application/json" } }).then(deleteDone) } function getTodoscallBack(data){ console.log(data); var parentElement = document.getElementById("mainArea"); // parentElement.innerHTML = JSON.stringify(data); for(var i=0;i<data.length;++i){ var childElement = document.createElement("div"); var grandChildren1 = document.createElement("span"); grandChildren1.innerHTML= data[i].title; var grandChildren2 = document.createElement("span"); grandChildren2.innerHTML= data[i].description; var grandChildren3 = document.createElement("button"); grandChildren3.innerHTML="Delete"; grandChildren3.setAttribute("onclick","deleteTodo("+data[i].id+")"); childElement.appendChild(grandChildren1); childElement.appendChild(grandChildren2); childElement.appendChild(grandChildren3); parentElement.appendChild(childElement); } } function callbackFn2(res){ res.json().then(getTodoscallBack); } function getData(){ fetch("http://localhost:3000/todos",{ method:"GET", }).then(callbackFn2); } getData(); function parsedResponse(data){ console.log(data); var parentElement = document.getElementById("mainArea"); var childElement = document.createElement("div"); var grandChildren1 = document.createElement("span"); grandChildren1.innerHTML= data.title; var grandChildren2 = document.createElement("span"); grandChildren2.innerHTML= data.description; var grandChildren3 = document.createElement("button"); grandChildren3.innerHTML="Delete"; childElement.appendChild(grandChildren1); childElement.appendChild(grandChildren2); childElement.appendChild(grandChildren3); parentElement.appendChild(childElement); } function callback(res){ res.json().then(parsedResponse); } function onPress(){ var title = document.getElementById("title").value; var description = document.getElementById("description").value; console.log(title,"\n",description); fetch("http://localhost:3000/todos",{ method:"POST", body: JSON.stringify({ title: title, description:description }), headers: { "Content-Type": "application/json" } }).then(callback); } </script> <body> Todo title <input type="text" id="title"></input> <br><br> Todo description <input type="text" id="description"></input> <br><br> <button onclick="onPress()">send todo</button> <div id="mainArea"> </div> </body> </html> 在 TODO 项目的删除功能中,我想删除具有给定 id 的特定待办事项,但我在选择父级(即 div 标签)时遇到困难,其中我存储了标题描述和删除按钮,我通过使用 javascript 发送请求来添加该按钮。问题如何使用removeChild()删除具有id的特定删除按钮的div标签?如何做到这一点? 我复制了与您完全相同的代码,并传递了一个伪造的数组来建模待办事项,就像您已经做的那样 const todos = [{ id: 1, title: 'title#1', description: 'description#1' }, { id: 2, title: 'title#2', description: 'description#2' }]; 为了与您的策略保持一致,在创建待办事项的逻辑中,我添加了使用相应的待办事项 id 设置每个删除按钮的 data-id 属性的功能,然后在 deleteDone 函数中我获取了单击的删除使用属性选择器按钮,然后删除使用 div 检索到的整个 closest 容器。 const todos = [{ id: 1, title: 'title#1', description: 'description#1' }, { id: 2, title: 'title#2', description: 'description#2' }]; getTodoscallBack(todos); function deleteDone(id) { console.log("Deleted todo ID:", id); //retrieves the delete button holding the data-id attribute passed const delButton = document.querySelector(`[data-id="${id}"`); //retrieves the element containing that button const todoContainer = delButton.closest('div'); //removes the whole div containing the todo todoContainer.remove(); } function deleteTodo(id) { /* fetch("http://localhost:3000/todos/" + id, { method: "DELETE", headers: { "Content-Type": "application/json" } }).then(deleteDone) */ deleteDone(id); } function getTodoscallBack(data) { console.log(data); var parentElement = document.getElementById("mainArea"); // parentElement.innerHTML = JSON.stringify(data); for (var i = 0; i < data.length; ++i) { var childElement = document.createElement("div"); var grandChildren1 = document.createElement("span"); grandChildren1.innerHTML = data[i].title; var grandChildren2 = document.createElement("span"); grandChildren2.innerHTML = data[i].description; var grandChildren3 = document.createElement("button"); grandChildren3.innerHTML = "Delete"; grandChildren3.setAttribute("onclick", "deleteTodo(" + data[i].id + ")"); //HERE I set the data-id attribute value as data[i].id grandChildren2.dataset.id = data[i].id; childElement.appendChild(grandChildren1); childElement.appendChild(grandChildren2); childElement.appendChild(grandChildren3); parentElement.appendChild(childElement); } } function callbackFn2(res) { res.json().then(getTodoscallBack); } function getData() { fetch("http://localhost:3000/todos", { method: "GET", }).then(callbackFn2); } getData(); function parsedResponse(data) { console.log(data); var parentElement = document.getElementById("mainArea"); var childElement = document.createElement("div"); var grandChildren1 = document.createElement("span"); grandChildren1.innerHTML = data.title; var grandChildren2 = document.createElement("span"); grandChildren2.innerHTML = data.description; var grandChildren3 = document.createElement("button"); grandChildren3.innerHTML = "Delete"; childElement.appendChild(grandChildren1); childElement.appendChild(grandChildren2); childElement.appendChild(grandChildren3); parentElement.appendChild(childElement); } function callback(res) { res.json().then(parsedResponse); } function onPress() { var title = document.getElementById("title").value; var description = document.getElementById("description").value; console.log(title, "\n", description); fetch("http://localhost:3000/todos", { method: "POST", body: JSON.stringify({ title: title, description: description }), headers: { "Content-Type": "application/json" } }).then(callback); } <body> Todo title <input type="text" id="title"> <br><br> Todo description <input type="text" id="description"> <br><br> <button onclick="onPress()">send todo</button> <div id="mainArea"> </div> </body>
IIS7.5 尝试使用 DELETE 动词时出现 500 内部服务器错误
我正在尝试对 IIS7.5 资源发出 DELETE: 删除 http://198.252.206.16:48251/Test/foo.ashx HTTP/1.1 接受: */* 接受语言:en-us 接受编码:gzip、deflate 用户代理:Mozilla...