in this post i will list some of SharePoint Rest API calls
Get the groups of current user using REST API
function getCurrentUserWithDetails() { var endpointUrl = _spPageContextInfo.webServerRelativeUrl + '/_api/web/currentuser/?$expand=groups'; return $.ajax({ url: endpointUrl, method: "GET", contentType: "application/json;odata=verbose", headers: { "Accept": "application/json;odata=verbose" } }); }
function getPagedItems(webUrl,listTitle,startItemId,itemsCount) { var endpointUrl = webUrl + "/_api/web/lists/getbytitle('" + listTitle + "')/items?$skiptoken=" + encodeURIComponent('Paged=TRUE&p_SortBehavior=0&p_ID=' + (startItemId-1) + '&$top=' + itemsCount); return executeRequest(endpointUrl,'GET'); } getPagedItems('https://contoso.sharepoint.com/','Pages',2,2) .done(function(data){ if(data.d.results.length == 0){ console.log('Items not found'); return; } for(var i = 0; i < data.d.results.length; i++){ var item = data.d.results[i]; console.log(item.Title); } });
function uploadFileBinary() { var executor = new SP.RequestExecutor(appweburl); var body = ""; for (var i = 0; i < 1000; i++) { var ch = i % 256; body = body + String.fromCharCode(ch); } var info = { url: "_api/web/lists/getByTitle('Shared Documents')/RootFolder/Files/Add(url='a.dat', overwrite=true)", method: "POST", binaryStringRequestBody: true, body: body, success: success, error: fail, state: "Update"}; executor.executeAsync(info); }