An HTTP header that's mandatory for this request is not specified

Gert-Jan van der Kamp 21 Reputation points

Hi all,

I keep getting this error message when trying to put data to Azure Datalake Storage Gen2 through REST API. I think I added every header I can find on this list but it still won't budge..

Can anyone spot the missing header? On a general note, the error messages could be a bit more useful. In this case it would help tremendously to specify which header is missing.

Here's my http request. Please note I use a JWT as authorization obtained from a InteractiveBrowserCredential. I'm pretty sure this worked a while back but I had to park it for a while and now it doesn't work anymore..

PUT HTTP/1.1  
Authorization: Bearer ey..0GVg  
x-ms-version: 2021-10-04  
x-ms-blob-type: BlockBlob  
Accept: application/json  
Content-Type: text/plain; charset=utf-8  
x-ms-client-request-id: 72450bf0-0c23-4451-8d4e-7192af588b62  
x-ms-date: Wed, 16 Nov 2022 17:53:12 GMT  
Content-Length: 110  
Expect: 100-continue  
Connection: Keep-Alive  
  "User": "bla bla",  
  "Year": 2022.0,  
  "Month": "Jan",  
  "Date": 44881.0,  
  "Hours": []  

And here's the reply I get.

HTTP/1.1 400 An HTTP header that's mandatory for this request is not specified.  
Content-Length: 204  
Content-Type: application/json;charset=utf-8  
Server: Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0  
x-ms-error-code: MissingRequiredHeader  
x-ms-request-id: 2daac0f9-401f-008b-56e4-f99c88000000  
x-ms-version: 2021-10-04  
x-ms-client-request-id: 72450bf0-0c23-4451-8d4e-7192af588b62  
Date: Wed, 16 Nov 2022 17:53:13 GMT  
{"error":{"code":"MissingRequiredHeader","message":"An HTTP header that's mandatory for this request is not specified.\nRequestId:2daac0f9-401f-008b-56e4-f99c88000000\nTime:2022-11-16T17:53:14.2864634Z"}}  
Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,424 questions
{count} votes