0

I am working on REST API calls on Azure storage table, I am successful to query table and get response in xml format but when I try to change the Accept header to JSON I am getting the exceptions.

Note: I set the value of x-ms-version to 2018-03-28

    headers.put("Authorization", "SharedKey " + store + ":" + hash);
    headers.put("x-ms-date", date);
//        headers.put("x-ms-version","2009-09-19");
    headers.put("x-ms-version","2018-03-28");
    headers.put("Accept-Charset","UTF-8");
//        headers.put("Accept","application/atom+xml,application/xml");
    headers.put("Accept","application/json;odata=nometadata");
    headers.put("DataServiceVersion","1.0;NetFx");
    headers.put("MaxDataServiceVersion","1.0;NetFx");

I am getting the Response status code 415 with message "JsonFormatNotSupportedJSON format is not supported."

2 Answers 2

2

DataServiceVersion and MaxDataServiceVersion are not necessary, but if you want to use, change them to 3.0;NetFx.

Only 3.0 is compatible with x-ms-version 2013-08-15 or later. See the document.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks lot @Jerry, we both got solution at same time :)
1

I have removed below 2 headers and now I am getting the response in JSON format.

    headers.put("DataServiceVersion","1.0;NetFx");
    headers.put("MaxDataServiceVersion","1.0;NetFx");

3 Comments

Please remove this answer and accept Jerry Liu's answer.
@ZhaoxingLu-Microsoft Sai posted their answer just 10 seconds apart, thus it is not a duplicate. I don't agree that it should be removed. - From review
I am not removing my solution (I have seen the response after my post) but I accepted @Jerry suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.