Last active
October 16, 2018 10:52
-
-
Save wictorwilen/1aa4d3ae2b0636ae9a893986bd00fd23 to your computer and use it in GitHub Desktop.
Client side updates of SharePoint stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('/_api/site', {headers:{accept:'application/json'}}).then( x => x.json().then( y => console.log(y))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('/_api/web', {headers:{accept:'application/json'}}).then( x => x.json().then( y => console.log(y))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('/_api/contextinfo', | |
{method:'POST', headers: { "Accept": "application/json; odata=verbose"}}).then( r => | |
r.json().then( d => { | |
console.log(d.d.GetContextWebInformation.FormDigestValue) | |
fetch('/_api/web', | |
{method:'POST', headers:{'content-type':'application/json;odata=verbose',accept:'application/json;odata=verbose','X-RequestDigest':d.d.GetContextWebInformation.FormDigestValue, 'x-http-method':'MERGE'}, | |
body: JSON.stringify({ | |
HeaderEmphasis:3, // 0-3 | |
HeaderLayout:2, // 0-2 | |
MegaMenuEnabled: true, | |
"__metadata":{"type":"SP.Web"}})}).then( x => | |
console.log(x) | |
) | |
} | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment