I'm trying to query Azure query blob content through REST API, following the documentation below
https://learn.microsoft.com/en-us/rest/api/storageservices/query-blob-contents
I made my blob contents public for testing and a GET request to blob URI is giving the content, but making a post request to mentioned URI
https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=query (replaced myaccount, mycontainer and myblob)
giving me following error
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>InvalidQueryParameterValue</Code>
<Message>Value for one of the query parameters specified in the request URI is invalid.
RequestId:1c52fc4f-801e-0061-63fc-f98163000000
Time:2021-02-03T07:15:32.9547540Z</Message>
<QueryParameterName>comp</QueryParameterName>
<QueryParameterValue>query</QueryParameterValue>
<Reason />
</Error>
blob content is JSON and Blob is a Block Blob type
I think you might use the SharedKey for authentication when using Query Blob Contents rest api.
If it's the case, you'd better add the steps or code about how do you build the Authorization header
. There might be a minor error there.
I give it a try by using sas token
for authentication(you can refer to this link for how to generate sas token
via azure portal or code), and it can work well.
Here is my request url:
https://yy1.blob.core.windows.net/a11/my11.csv?comp=query&my_sas_token
And in postman, the request headers
are as below:
the request body
is as below:
And as you can see the test results in the above screenshots, the status code is 200, and we can get the expected blob content.