0
votes

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

2 Answers

2
votes

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.

1
votes

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");