JSON格式不受Azure存储REST API支持的异常 [英] JSON format Not supported exception from Azure storage REST API

查看:95
本文介绍了JSON格式不受Azure存储REST API支持的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理Azure存储表上的REST API调用,我成功查询了表并获得xml格式的响应,但是当我尝试将Accept标头更改为JSON时,我得到了异常.

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.

注意:我将x-ms-version的值设置为2018-03-28

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

我收到消息"JsonFormatNotSupported不支持JSON格式"的响应状态代码415.

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

推荐答案

DataServiceVersionMaxDataServiceVersion不是必需的,但是如果要使用,请将其更改为3.0;NetFx.

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

只有3.0与x-ms-version 2013-08-15 or later兼容.请参阅文档.

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

这篇关于JSON格式不受Azure存储REST API支持的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆