SharePoint 2010 REST API JQUery Insert, Update, Delete -


can explain or point me link samples of doing update, delete using jquery sharepoint 2010 rest api?

i have insert working , of course queries since msdn documentation explains , every tutorial on net explains queries wondering if ever inserts, updates, deletes data instead of samples , tutorials on querying? yes know can use csom want learn how done via jquery , sharepoint rest?

also want use merge updating.

here's working insert code:

function insertmilestone() {             var milestoneslisturl = "/_vti_bin/listdata.svc/milestones";                    var milestone = {};                milestone.title = "testing rest";                 var entry = json.stringify(milestone);                 $.ajax({                    type: "post",                    url: milestoneslisturl,                    data: entry,                    contenttype: "application/json; charset=utf-8",                    error: function (xhr) {                        alert(xhr.status + ": " + xhr.statustext);                    },                     success: function () {                        getall();                     }                });            } 

i worked rest api sp 2013, example poc can used call implementation i.e. jquery, c# etc.

using postman

first digest token:

a method found on site : http://tech.bool.se/basic-rest-request-sharepoint-using-postman/[credit credit due]

post

http://<sharepoint domain url>/sites/<site name>/_api/contextinfo 

header:

accept : application/json;odata=verbose 

body: clear body ​

from payload use "formdigestvalue" value , put headers key : x-requestdigest when making actions alter items in sharepoint.

reading data:

get

http://<sharepoint domain url>/sites/<site name>/_api/web/getfolderbyserverrelativeurl('/sites/<site name>/shared documents/my folder')/files?$select=name 

headers:

accept : application/json;odata=verbose​ 

when comes create, update , delete need digest token or authorization token perform these actions, token highlighted @ begining to retrieve.

​creating data post

http://<sharepoint domain url>/sites/<site name>/_api/web/folders​ 

headers:

accept : application/json;odata=verbose  x-requestdigest : 'guid looking toking'  content-type : application/json;odata=verbose 

body:

{ '__metadata': { 'type': 'sp.folder' }, 'serverrelativeurl': '/sites/<site name>/shared documents/some folder/poc3'}​ 

note: 'serverrelativeurl' folder on end poc3 folder want create

related resources: http://msdn.microsoft.com/en-us/library/office/fp142380(v=office.15).aspx

note: postman used example , other application may need url encode endpoint.

the above request structure can used requests, related resource highlights of standard methods can used rest api


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -