ProfessorD1906_4
ProfessorD1906_4

Reputation: 43

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. 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....

Upvotes: 0

Views: 920

Answers (2)

RaytheonXie-MSFT
RaytheonXie-MSFT

Reputation: 1

You can refer to the following url

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

Upvotes: 0

Nikhil Chauhan
Nikhil Chauhan

Reputation: 23

Can you try with changing the code?

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

Upvotes: 0

Related Questions