Introduction to the SharePoint 2013 REST API By QuontraSolutions PowerPoint PPT Presentation

presentation player overlay
1 / 19
About This Presentation
Transcript and Presenter's Notes

Title: Introduction to the SharePoint 2013 REST API By QuontraSolutions


1
Introduction to the SharePoint 2013 REST API
By QuontraSolutions
  • Email info_at_quontrasolutions.com
  • Call us 404-900-9988
  • WebSite www.quontrasolutions.com

2
AGENDA
  • REST and ODATA Overview
  • SharePoint 2013 REST API
  • Demos

3
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

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

5
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

6
OData URIs
  • URI has three parts
  • Service root URI
  • Resource path
  • Query string options

Resource Path to a SharePoint Object
Service Root URI
Query String Options
7
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

8
DEMO
9
Critical Tools
  • Fiddler
  • Core jQuery library
  • Browser developer tools
  • Advanced REST Client (Chrome App)
  • Postman (Chrome App)

10
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-Request Digest
  • Encrypted security value required for updates
  • IF-MATCH
  • Passes Etag value to control optimistic
    concurrency

11
AJAX Calls
  • .ajax() function is part of the core jQuery
    library
  • URI end point
  • Accept header application/jsonodataverbose

12
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
  • ltsite urlgt/_api/contextinfo

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

14
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

15
Creating list items
16
Delete list items
17
Update List Items
18
Current REST Issues
  • REST API does have support for
  • Managed Metadata
  • Workflows
  • Lacks batching support

19
Thank You!
Write a Comment
User Comments (0)
About PowerShow.com