{"id":1925,"date":"2018-11-04T11:00:17","date_gmt":"2018-11-04T11:00:17","guid":{"rendered":"https:\/\/developer.microsoft.com\/en-us\/office\/blogs\/?p=1925"},"modified":"2018-11-04T11:00:17","modified_gmt":"2018-11-04T11:00:17","slug":"30daysmsgraph-day-4-request-syntax","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/30daysmsgraph-day-4-request-syntax\/","title":{"rendered":"30DaysMSGraph \u2013 Day 4 \u2013 Request syntax"},"content":{"rendered":"<p><a href=\"https:\/\/aka.ms\/30DaysMSGraph\">List of all posts in the #30DaysMSGraph series<\/a><\/p>\n<p>In <a href=\"https:\/\/developer.microsoft.com\/en-us\/graph\/blogs\/30daysmsgraph-day-3-graph-explorer\">Day 3<\/a> we discussed the Graph Explorer.\u00a0 Today we&#8217;ll inspect the syntax for Microsoft Graph requests.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-1974 size-large\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/10\/31DaysMSGraph_Day4_Source-1024x109.jpg\" alt=\"\" width=\"1024\" height=\"109\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/10\/31DaysMSGraph_Day4_Source-1024x109.jpg 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/10\/31DaysMSGraph_Day4_Source-300x32.jpg 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/10\/31DaysMSGraph_Day4_Source-768x81.jpg 768w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/10\/31DaysMSGraph_Day4_Source.jpg 1056w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h3>Syntax<\/h3>\n<p><a href=\"https:\/\/graph.microsoft.com\/%7bversion%7d\/%7bresource%7d\/%7bid%7d\/%7bproperty%7d?%7bquery-parameters%7d\">https:\/\/graph.microsoft.com\/{version}\/{resource}\/{id}\/{property}?{query-parameters}<\/a><\/p>\n<h3>HTTP Verbs<\/h3>\n<p>Microsoft Graph accepts requests using the following HTTP verbs which dictate what operation will be performed:<\/p>\n<ul>\n<li>GET &#8211; Read data from a resource<\/li>\n<li>POST &#8211; Create a new resource or perform an action<\/li>\n<li>PATCH &#8211; Update a resource with new values<\/li>\n<li>PUT &#8211; Replace a resource with a new one<\/li>\n<li>DELETE &#8211; Remove a resource<\/li>\n<\/ul>\n<h3>Version<\/h3>\n<p>Microsoft Graph currently supports (as of publishing date Nov 2018) the following versions:<\/p>\n<ul>\n<li><strong>v1.0<\/strong> &#8211; generally available APIs that are intended for production apps.<\/li>\n<li><strong>beta<\/strong> &#8211; APIs that are in preview and may include breaking changes. Not intended for production apps.\u00a0 Only recommended for development or testing purposes.<\/li>\n<\/ul>\n<p>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.<\/p>\n<p>For a changelog of what has changed in either version of Microsoft Graph APIs please refer to the <a href=\"https:\/\/developer.microsoft.com\/en-us\/graph\/docs\/concepts\/changelog\">Changelog for Microsoft Graph<\/a>.<\/p>\n<h3>Resource<\/h3>\n<p>The top-level endpoint that dictates the underlying services that your request will interact with.\u00a0 Examples include:<\/p>\n<ul>\n<li>Users<\/li>\n<li>Groups<\/li>\n<li>Sites<\/li>\n<li>Drives<\/li>\n<li>Me<\/li>\n<li>Devices<\/li>\n<li>Etc.<\/li>\n<\/ul>\n<p>Many resources have relationships to other resources making it easier to traverse the graph.\u00a0 For example, \/me\/drive, \/users\/{id}\/events, etc.<\/p>\n<h3>Id (Optional)<\/h3>\n<p>Specifies a member of a collection such as an individual user, group, site, etc.<\/p>\n<h3>Property (Optional)<\/h3>\n<p>Specifies a property of the parent resource.<\/p>\n<h3>Query Parameters (Optional)<\/h3>\n<p>Modify the response to filter out records, include \/ exclude properties, sort results, and more.<\/p>\n<p>&nbsp;<\/p>\n<h2>Try It Out<\/h2>\n<p>Explore additional resources related to the\u00a0<strong>Me<\/strong>\u00a0(logged in user) entity and also add query parameters to filter the base query.\u00a0 Navigate to the <a href=\"https:\/\/aka.ms\/ge\">Graph Explorer<\/a> then\u00a0execute the following commands:<\/p>\n<p><a href=\"https:\/\/github.com\/microsoftgraph\/30DaysMSGraph-TryItOut\/blob\/master\/Day04-RequestSyntax.md\">Day 4 repo link<\/a><\/p>\n<ol>\n<li>Get logged in user&#8217;s OneDrive site\n<ul>\n<li><a href=\"https:\/\/graph.microsoft.com\/v1.0\/me\/drive\">https:\/\/graph.microsoft.com\/v1.0\/me\/drive<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Get users whose email address starts with &#8220;Adele&#8221;\n<ul>\n<li><a href=\"https:\/\/graph.microsoft.com\/v1.0\/users?$filter=startswith(mail,'adele')\">https:\/\/graph.microsoft.com\/v1.0\/users?$filter=startswith(mail,&#8217;adele&#8217;)<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Get logged in user&#8217;s user profile picture\n<ul>\n<li><a href=\"https:\/\/graph.microsoft.com\/v1.0\/me\/photo\/$value\">https:\/\/graph.microsoft.com\/v1.0\/me\/photo\/$value<\/a><\/li>\n<\/ul>\n<\/li>\n<li>(Choose a new sample query by clicking <strong>show more samples<\/strong> from the left hand menu)<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>For more information on Microsoft Graph request syntax see the official documentation at <a href=\"https:\/\/developer.microsoft.com\/en-us\/graph\/docs\/concepts\/use_the_api\">Use the Microsoft Graph API<\/a>.\u00a0 Join us tomorrow as we dive deeper into available query parameters in <a href=\"https:\/\/developer.microsoft.com\/en-us\/graph\/blogs\/30daysmsgraph-day-5-query-parameters-part-1\/\">Day 5<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Day 3 we discussed the Graph Explorer.\u00a0 Today we&#8217;ll inspect the syntax for Microsoft Graph requests.<\/p>\n","protected":false},"author":73055,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[84],"class_list":["post-1925","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-graph","tag-30daysmsgraph"],"acf":[],"blog_post_summary":"<p>In Day 3 we discussed the Graph Explorer.\u00a0 Today we&#8217;ll inspect the syntax for Microsoft Graph requests.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/1925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/73055"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=1925"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/1925\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=1925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=1925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=1925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}