Skip to content

Instantly share code, notes, and snippets.

@eirikb

eirikb/demo.js Secret

Created December 13, 2016 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eirikb/a247078160d9ca4349a3d0bd29eff642 to your computer and use it in GitHub Desktop.
Save eirikb/a247078160d9ca4349a3d0bd29eff642 to your computer and use it in GitHub Desktop.
(async() => {
const o = {
method: 'POST',
credentials: 'include',
headers: {
accept: 'application/json'
}
};
o.headers['X-RequestDigest'] = (await (fetch(`/_api/ContextInfo`, o).then(res => res.json()))).FormDigestValue;
const items = await (fetch(`/_api/Lists/GetByTitle('Company')/GetItems(query=@q)?@q=${JSON.stringify({
ViewXml: '<View><Query><Where><Contains><FieldRef Name="Title" /><Value Type="Text">Micro</Value></Contains></Where></Query></View>'
})}&$filter=substringof('soft',Title)`, o).then(res => res.json()));
console.log(items.value);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment