Skip to content

Instantly share code, notes, and snippets.

@premsh
Created May 1, 2013 00:23
Show Gist options
  • Save premsh/5492901 to your computer and use it in GitHub Desktop.
Save premsh/5492901 to your computer and use it in GitHub Desktop.
Sample REST api call for SharePoint-Hosted app
$.ajax(
{
url: _spPageContextInfo.webServerRelativeUrl + "/_api/web/currentuser",
type: "GET",
headers: {
"accept": "application/json;odata=verbose",
},
success: function (data) {
$("#message").text('Hello ' + data.d.Title);
},
error: function (err) {
alert(JSON.stringify(err));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment