简体   繁体   English

SharePoint REST API。 在 SharePoint 列表上进行 AJAX 调用时出现 400 错误请求

[英]SharePoint REST API. 400 Bad Request when Making an AJAX call on SharePoint List

Good Afternoon.下午好。 I'm not sure what I'm doing wrong here.我不确定我在这里做错了什么。 I have a REST API call on a SharePoint list and for the life of me cannot figure out why I'm getting a 400 Bad Request message.我在 SharePoint 列表上有一个 REST API 调用,我终生无法弄清楚为什么我会收到 400 错误请求消息。 Here's my call....这是我的电话....

myURL = "my sharepoint site URL"

$.ajax({
url: myURL + "/org/Analysis/_api/web/list/GetByTitle('Analysis')/items?$filter=Accepted%20eq%20%27Yes%27&$select=Date_x0020_of_x0020_Activity, Accepted"
method: "GET"
headers:{"ACCEPT" : "application/json;odata=verbose",
"content-type":"application/json;odata=verbose"
},
// success function and some other stuff


});

Thank you in advance....先感谢您....

Can you try with changing the code?你可以尝试更改代码吗?

headers: { 
    "Accept": "application/json;odata=verbose",  
    "Content-Type": "application/json;odata=verbose",  
    "X-RequestDigest": $("#__REQUESTDIGEST").val()  
}

You can refer to the following url可以参考以下url

_api/web/list/GetByTitle('Analysis')/items?$select=Date_x0020_of_x0020_Activity,Accepted&$filter=Accepted eq 'Yes'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM