AnsweredAssumed Answered

CAML Query in REST API for Nintex forms

Question asked by yrajendarreddy@gmail.com on Nov 27, 2017

Hi All,

 

Am trying to fetch the records which is matching to CAML query, but how to pass CAML Query in Nintex REST API.

 

function getQuestion()
{
questionurlAPI=_spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('listName')/items";
console.log(questionurlAPI);
var caml = "<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>456</Value></Eq></Where></Query></View>";
var camlquery = { "query" :{"__metadata": { "type": "SP.CamlQuery" }, "ViewXml": caml}};
NWF$.ajax({
url:questionurlAPI,
type: "GET",
data: camlquery,
headers: { "Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-RequestDigest": NWF$("#__REQUESTDIGEST").val(),
"IF-MATCH": "*",
"X-HTTP-Method": null
},

success: function(data) {
alert(data.d.Question);

},
error: function(data, errorCode, errorMessage)
{
alert("Could not get the Question " + errorMessage);
}
});
}

 

when we run the above script we are getting undefined in alert. 

 

please suggest me

Outcomes