标签: json api rest sharepoint-2010
我需要以下网址才能返回JSON: https://mysite/_vti_bin/listdata.svc/Pages
我尝试将以下内容添加到网址中(根据在线博客但不起作用): https://mysite/_vti_bin/listdata.svc/Pages?format=JSON
它总是返回XML。另外,我没有通过C#或JS代码调用Web服务。我使用内置API消费的快速app dev平台。我需要的只是返回JSON(给定一个URL结构),我得到了我需要的东西。感谢。
答案 0 :(得分:8)
默认情况下,SharePoint 2010 REST服务以XML格式返回结果。要以JSON格式获取结果,请将Accept标头设置为application/json;odata=verbose。
Accept
application/json;odata=verbose
示例强>
url: http://site url/_vti_bin/listdata.svc/ListName, method: GET Headers: accept: "application/json;odata=verbose"
<强>结果强>