SharePoint 2010 REST API JQUery Insert, Update, Delete

后端 未结 3 996
小鲜肉
小鲜肉 2020-12-08 01:31

Can anyone explain or point me to a link with samples of doing Update, Delete using Jquery with the SharePoint 2010 Rest API?

I have the insert working and of course

3条回答
  •  离开以前
    2020-12-08 02:07

    I recently worked with the REST API for SP 2013, as a Example POC that can be used for any call implementation i.e. JQuery, C# etc.

    Using POSTMAN

    First get your digest token:

    A method was found on this site : http://tech.bool.se/basic-rest-request-sharepoint-using-postman/​ [Credit where credit is due]

    POST

    http:///sites//_api/contextinfo
    

    Header:

    Accept : application/json;odata=verbose
    

    Body: Clear the body ​

    From the payload use "FormDigestValue" value and put it into your headers with the key : X-RequestDigest when making actions that alter items in SharePoint.

    Reading data:

    GET

    http:///sites//_api/web/getfolderbyserverrelativeurl('/Sites//Shared Documents/My Folder')/files?$select=Name
    

    Headers:

    Accept : application/json;odata=verbose​
    

    When it comes to create, update , delete you need the digest token or an authorization token to perform these actions, this token is highlighted at the begining to to retrieve.

    ​Creating Data POST

    http:///sites//_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//Shared Documents/Some Folder/POC3'}​
    

    Note: 'ServerRelativeUrl' the folder on the end POC3 is the folder that I want to create

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

    Note: PostMan was used for this example and other application may need you to url encode the endpoint.

    The above Request Structure can be used for all requests, the related resource highlights some of the standard methods that can be used with the REST Api

提交回复
热议问题