30DaysMSGraph – Day 4 – Request syntax

Brian T. Jackett

List of all posts in the #30DaysMSGraph series

In Day 3 we discussed the Graph Explorer.  Today we’ll inspect the syntax for Microsoft Graph requests.

Syntax

https://graph.microsoft.com/{version}/{resource}/{id}/{property}?{query-parameters}

HTTP Verbs

Microsoft Graph accepts requests using the following HTTP verbs which dictate what operation will be performed:

  • GET – Read data from a resource
  • POST – Create a new resource or perform an action
  • PATCH – Update a resource with new values
  • PUT – Replace a resource with a new one
  • DELETE – Remove a resource

Version

Microsoft Graph currently supports (as of publishing date Nov 2018) the following versions:

  • v1.0 – generally available APIs that are intended for production apps.
  • beta – APIs that are in preview and may include breaking changes. Not intended for production apps.  Only recommended for development or testing purposes.

You may find that the beta version of a specific endpoint includes additional properties, formats available, or other changes from the v1.0 equivalent API.

For a changelog of what has changed in either version of Microsoft Graph APIs please refer to the Changelog for Microsoft Graph.

Resource

The top-level endpoint that dictates the underlying services that your request will interact with.  Examples include:

  • Users
  • Groups
  • Sites
  • Drives
  • Me
  • Devices
  • Etc.

Many resources have relationships to other resources making it easier to traverse the graph.  For example, /me/drive, /users/{id}/events, etc.

Id (Optional)

Specifies a member of a collection such as an individual user, group, site, etc.

Property (Optional)

Specifies a property of the parent resource.

Query Parameters (Optional)

Modify the response to filter out records, include / exclude properties, sort results, and more.

 

Try It Out

Explore additional resources related to the Me (logged in user) entity and also add query parameters to filter the base query.  Navigate to the Graph Explorer then execute the following commands:

Day 4 repo link

  1. Get logged in user’s OneDrive site
  2. Get users whose email address starts with “Adele”
  3. Get logged in user’s user profile picture
  4. (Choose a new sample query by clicking show more samples from the left hand menu)

 

For more information on Microsoft Graph request syntax see the official documentation at Use the Microsoft Graph API.  Join us tomorrow as we dive deeper into available query parameters in Day 5.

Feedback usabilla icon