InvalidQueryParameterValue in Query Blob Contents using REST API

Viewed 7634

I'm trying to query Azure query blob content through REST API, following the documentation below

https://docs.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)

gibing me following error

<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
 
1 Answers

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:

enter image description here

the request body is as below:

enter image description here

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.

Related