Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 1.57 KB

http-verb-tunneling.md

File metadata and controls

44 lines (36 loc) · 1.57 KB
author ms.author ms.date ms.topic title ms.localizationpriority
JeremyKelley
JeremyKe
09/10/2017
conceptual
Tunneling HTTP verbs - OneDrive API
Medium

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.