I want to query my custom list using REST API + CAML. And I have to use POST request to be able to get the managed metadata values (mainly Label), so I tried the below Ajax request:
var body = {
'query':{
'__metadata': { 'type': 'SP.CamlQuery' },
'ViewXml': "<View><Query><Where><Eq><FieldRef Name='Id'/><Value Type='Number'>"+orderID+"</Value></Eq></Where></Query></View>"
}
};
$.ajax({
url: "/*****/_api/web/lists/getbytitle('*****')/GetItems",
method: "POST",
contentType : "application/json;odata=verbose",
async: false,
data: JSON.stringify(body),
headers: {
"Accept": "application/json; odata=verbose",
"X-RequestDigest": $('#__REQUESTDIGEST').val()
},
success: function (data) {
if(data.d.results.length>0){
var items=data.d.results;
for(var i=0;i<items.length;i++){
//code goes here
}
console.log(data);
}
}
});
but I got the following exception:
One or more field types are not installed properly. Go to the list settings page to delete these fields.
So can anyone advice on the above error? Although the list have a field named Id of type Number.
<d:Id m:type="Edm.Int32">417</d:Id>
so ithought i need to use Id!!