Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to the SharePoint 2013 REST API. 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge

Similar presentations


Presentation on theme: "Introduction to the SharePoint 2013 REST API. 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge"— Presentation transcript:

1 Introduction to the SharePoint 2013 REST API

2 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge http://www.sparkhound.com/pages/blogs.asp x @codygros Leader of the Baton Rouge SharePoint User Group – www.brspug.comwww.brspug.com

3 3 AGENDA REST and ODATA Overview SharePoint 2013 REST API Demos

4 4 REST Introduction REST = REpresentational State Transfer A simpler alternative to SOAP based on HTTP request/response pairs Client sends HTTP requests that target specific resources using unique URIs

5 5 What is OData? Odata is a standardized REST API for Data Access ODATA API maps CRUD operations to HTTP verbs http://www.odata.org

6 6 HTTP Methods GET Returns an item or array of items POST Creates a new item PUT Updates an item (replaces all fields with default values) PATCH or MERGE Updates an item in place (existing values are retained) DELETE Deletes an item

7 7 OData URIs URI has three parts Service root URI Resource path Query string options Service Root URI Resource Path to a SharePoint Object Query String Options

8 8 OData Query Option Parameters $select Specifies which columns to retrieve $filter Selecting what items to retrieve $orderby Sorting items $expand Retrieve results that are usually deferred $top Select how many items to return $skip Selecting which row to start at

9 9 DEMO

10 10 Critical Tools Fiddler Core jQuery library Browser developer tools Advanced REST Client (Chrome App) Postman (Chrome App)

11 11 Request Headers Accept what type of data you want to receive Content-type What type of data you are sending in the request body X-HTTP-Method Which operation to perform X-RequestDigest Encrypted security value required for updates IF-MATCH Passes Etag value to control optimistic concurrency

12 12 AJAX Calls $.ajax() function is part of the core jQuery library URI end point Accept header: application/json;odata=verbose

13 13 Request Digest Provides security mechanism to protect against replay attacks SharePoint pages has element with ID __REQUESTDIGEST Passed in request by using X-RequestDigest header /_api/contextinfo

14 14 Creating / Updating You must include item type metadata for inserts & updates All write operations must pass valid request digest value

15 15 List Item Type Metadata Each SharePoint list has a unique type for its list items String based type value must be passed will all inserts and updates

16 16 Creating list items

17 17 Delete list items

18 18 Update List Items

19 19 Current REST Issues REST API does have support for Managed Metadata Workflows Lacks batching support *

20 20 Questions?

21 21


Download ppt "Introduction to the SharePoint 2013 REST API. 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge"

Similar presentations


Ads by Google