Using additional HTTP verbs when your client is limited
There are some cases where apps can't make HTTP requests with verbs other than GET or POST. For example, some proxies, firewalls, etc. might be configured by their operators to block certain HTTP verbs, or certain app environments might not support other verbs. For these cases, the OneDrive API provides an alternative way of specifying an HTTP verb when necessary.
You can tunnel any HTTP request through a POST by making a POST request and
adding the X-HTTP-Method-Override
header set to the method you want to invoke.
This signals the server to process the request not as a POST, but as whatever
verb was specified as the value of that header.
This header is only valid for POST requests. It will be ignored for other HTTP methods.
For example, if the DELETE verb is blocked by a firewall, your application can tunnel the verb to the API to ensure that your app can still delete a file.
POST /drive/items/{item-id} HTTP/1.1
Host: api.onedrive.com
X-HTTP-Method-Override: DELETE
This request will delete the resource identified. The response from the service will match the response that would have been returned if the HTTP method had DELETE.
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應