Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Best practices with Microsoft Graph: Making your applications more performant, resilient, and reliable.

593 views

Published on

Learn how to take advantage of APIs, platform capabilities and intelligence from Microsoft Graph to make your app more performant, more resilient and more reliable

Published in: Technology
  • Be the first to comment

Best practices with Microsoft Graph: Making your applications more performant, resilient, and reliable.

  1. 1. @dkershaw_msft
  2. 2. your Your app Gateway Your or your customer’s data Office 365 Windows 10 Enterprise Mobility + Security 1Microsoft Graph
  3. 3. Get to know the API
  4. 4. prepared
  5. 5. Graph uses server- side page size limits When querying collections, Graph may return the results in many pages Always expect an @odata.nextLink property in the response Contains the URL to the next page
  6. 6. 1. Always handle the possibility that the responses are paged in nature 2. Follow the @odata.nextLink to obtain the next page of results 3. Final page will not contain an @odata.nextLink property 4. Treat the entire URL as an opaque string
  7. 7. Error Best practice 403 How did this happen? My application got consent! The signed-in user does not have privileges to access the resource requested. Tip: Provide a generic "Access denied" error back to the signed-in user. 404 How did this happen? I just got this resource! Resource not yet provisioned (like a user's photo) Resource has been deleted Tip: Watch for restore - your application should also take this into account. 429 Your app should always be prepared to be throttled. Tip: Honor the HTTP Retry-After response header to recover Tip: Rate limit to stay below throttle limits 503 Service is busy Tip: Retry – but employ a back-off strategy similar to 429 Tip: Additionally, always make new retry requests over a new HTTP connection
  8. 8. Retry logic for transient errors
  9. 9. Storing data locally in your application required terms of service privacy policy retention deletion policies
  10. 10. Optimizations
  11. 11. Use projections GET ? $select=givenName,mail Choose the properties your app really needs and no more Don’t send unnecessary data over the wire Tip Use $select
  12. 12. Use filters GET ? $filter=department eq ‘Sales’ & $select=givenName,mail Choose the records your app really needs and no more Don’t send unnecessary data over the wire Tip Use $filter
  13. 13. POST/PATCH/PUT If your code doesn’t need to get a response, then opt out Don’t send unnecessary data over the wire Tip Use HTTP Prefer return=minimal request header
  14. 14. Webhooks Scenario Application needs to know about changes to data – like deleted users Tips Use webhook notifications whenever data of interest has changed Put notifications in a queue for later processing Why Avoid computationally expensive and excessive polling
  15. 15. Delta query Scenario Need to cache or store Microsoft Graph data locally, and keep that data up to date, or track changes to data for any other reasons Tip Use delta query Why Stop retrieving data your application already has! Minimizes network traffic Reduces the likelihood of reaching a throttling threshold
  16. 16. Webhooks Delta query Scenario Same scenarios as before, but if you need to optimize further… Tips Use webhook notifications as the trigger to make delta query calls Put notifications in a queue for later processing Why Difficult to figure out optimal polling interval THR2436 Barracuda Sentinel: Microsoft Graph powered AI for real-time cyber fraud defense
  17. 17. Batching Scenario Mobile client app needs to get signed-in user’s profile AND avatar Tip Use JSON batching Why Performance gains through multiplexing Save the application significant network latency Conserves connection resources Lower bandwidth consumption
  18. 18. best practices https://aka.ms/graphBestPractices
  19. 19. influence our roadmap User Voice
  20. 20. Related sessions BRK2409 Leveraging SharePoint as a development platform for the modern intranet Tue 4:45 BRK2406 Coding Enterprise Apps for Intune – Protected, Secured & Integrated Wed 8:30 BRK2410 Data-Driven and User-Centric: Improving enterprise productivity and engagement through graph powered notifications Wed 4:30 THR3304 Cognitive Services + Microsoft Graph Tue 5:30 THR2430 Intelligent Edge: Microsoft Graph and IoT Wed 9:00 THR2413 Bots + Teams + Microsoft Graph: the perfect combo to help manage your calendar Wed 11:00 THR3302 Azure Functions and Microsoft Graph Wed 12:30 THR2436 Barracuda Sentinel: Microsoft Graph powered AI for real-time cyber fraud defense Wed 1:00 THR2437 Smart UI with Adaptive Cards, Microsoft Graph and beyond Wed 2:00 TSP2013 Microsoft Graph Device Remote Sessions Wed 3:30 WRK2510 Build intelligent intranet portals with SharePoint Wed 4:00
  21. 21. https://graph.microsoft.com Twitter #MicrosoftGraph GitHub /MicrosoftGraph StackOverflow [MicrosoftGraph]

×