0
votes

Can any help on my following usage of Azure Data Lake Gen2 REST API. when I am going to flush to data to the file, it has error :

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

enter image description here

Error message after adding the header x-ms-date

enter image description here

My Steps : Step 1 PUT https://.dfs.core.windows.net/mydatalakefs/testing.json?resource=file

Header Content-Length : 0 x-ms-version:2018-11-09 Authorization :Bearer

Step 2 PATCH https://.dfs.core.windows.net/mydatalakefs/testing.json?action=append&position=0

Header Content-Type:application/json Content-Length:15 x-ms-version:2018-11-09 Authorization :Bearer

Body {"name":"1234"}

Step 3 Patch https://.dfs.core.windows.net/mydatalakefs/testing.json?action=flush&position=15

header Content-Length:0 x-ms-version:2018-11-09 Authorization :Bearer x-ms-date: Mon, 24 Sep 2019 05:53:53 GMT

1

1 Answers

0
votes

Update 0924:

You should do the append action first, then do the flush action:

step 1:

append action, make sure the json length is correct. Then in postman:

In headers:

enter image description here

In body, input the json:

enter image description here

step 2:

Then do the flush action in postman:

enter image description here


The error message gives a tip but not detailed. Actually, you're missing the required header: x-ms-date .

So please add x-ms-date and it's value(UTC/GMT format) in the request header like below:

x-ms-date: Mon, 23 Sep 2019 05:53:53 GMT

For how to generate the value for x-ms-date, using power shell as example:

In power shell, using this line of code: [System.DateTime]::UtcNow.ToString("R")