{"id":13352,"date":"2023-03-30T01:33:09","date_gmt":"2023-03-30T08:33:09","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/?p=13352"},"modified":"2023-03-30T09:27:47","modified_gmt":"2023-03-30T16:27:47","slug":"microsoft-graph-developer-proxy-v0-6-monitoring-rate-limiting-paging-guidance","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/microsoft-graph-developer-proxy-v0-6-monitoring-rate-limiting-paging-guidance\/","title":{"rendered":"Microsoft Graph Developer Proxy v0.6 with monitoring, rate limiting and paging guidance"},"content":{"rendered":"<p>Build resilient and performant apps with the latest preview version of the <a href=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/introducing-the-microsoft-graph-developer-proxy-community-preview\/#what-is-the-microsoft-graph-developer-proxy\"><strong>Microsoft Graph Developer Proxy<\/strong><\/a>. In this new version, we\u2019re excited to introduce support for monitoring specific processes, a new plugin allowing testing against rate limiting supported APIs, provide a new OData paging guidance and other smaller improvements!<\/p>\n<p><a href=\"https:\/\/aka.ms\/graph\/proxy\/download\">Download Microsoft Graph Developer Proxy v0.6<\/a> and check if your apps properly handle API errors.<\/p>\n<h2>Monitor specific processes<\/h2>\n<p>Using Developer Proxy, you can intercept any calls to any APIs happening on your machine. While this could be a way to validate how your app is handling errors, you might also want to isolate which processes you should be intercepting with the Developer Proxy.<\/p>\n<p>In this release, we are introducing support to enable which processes you want to intercept requests from by specifying either their ids or their names. This allows you to test only the calls coming from a terminal, a browser or from a back-end service. Consequently, this will likely reduce the number of unwanted requests coming from your machine (OneDrive, Teams, etc.) and allow for more clarity in the calls reported by the Developer Proxy.<\/p>\n<p><em>Monitoring a single process in Developer Proxy<\/em><\/p>\n<p>To start monitoring a single process:<\/p>\n<ul>\n<li>Use the `&#8211;watch-pids` argument when starting the proxy to use the process id or<\/li>\n<li>Use the `&#8211;watch-process-names` argument when starting the proxy to use the process name or<\/li>\n<\/ul>\n<p>https:\/\/gist.github.com\/sebastienlevert\/22efee2149544380cef22371253b7cf8<\/p>\n<p>To learn more about using recording in Developer Proxy, see the <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-developer-proxy\/wiki\/Monitor-requests-from-specific-processes\">documentation<\/a>.<\/p>\n<h2>Test your app against rate limiting APIs<\/h2>\n<p>As you use the Developer Proxy to simulate errors in your apps, you might have come across RateLimit-* headers. In this release, you will now be able to use endpoints that are embracing rate limiting capabilities (including Files and Sites on Microsoft Graph)!<\/p>\n<p>To get started, run mgdp with our specific plugin preset using the following command:<\/p>\n<p>https:\/\/gist.github.com\/waldekmastykarz\/285ef0a048a4c52b253f200aee6b509b<\/p>\n<p>When you start calling Microsoft Graph, at first, all requests will be passed through. As you get closer to the threshold limit, Developer Proxy will start adding the RateLimit headers to responses:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-1.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-13357\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-1-1024x783.png\" alt=\"RateLimit headers added by Developer Proxy to a response from Microsoft Graph\" width=\"640\" height=\"489\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-1-1024x783.png 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-1-300x229.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-1-768x587.png 768w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-1.png 1100w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 10pt;\"><em>RateLimit headers added by Developer Proxy to a response from Microsoft Graph<\/em><\/span><\/p>\n<p>If you keep calling Microsoft Graph, and don\u2019t back off, exceeding the resource limit, Developer Proxy will throttle you and return a 429 Too Many Requests response. In the Retry-After header, Developer Proxy will communicate the number of seconds for you to wait before retrying the request.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-2.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-13356\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-2-1024x778.png\" alt=\"Developer Proxy throttling requests after exceeding the rate limiting threshold\" width=\"640\" height=\"486\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-2-1024x778.png 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-2-300x228.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-2-768x584.png 768w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-2.png 1100w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 10pt;\"><em>Developer Proxy throttling requests after exceeding the rate limiting threshold<\/em><\/span><\/p>\n<p>If you don\u2019t back off and keep issuing web requests, Developer Proxy will forcefully fail your requests with a 429 Too Many Requests response.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-3.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-13355\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-3-1024x763.png\" alt=\"Developer Proxy forcefully failing requests that don\u2019t adhere to the Retry-After limit.\" width=\"640\" height=\"477\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-3-1024x763.png 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-3-300x224.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-3-768x573.png 768w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-3.png 1100w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 10pt;\"><em>Developer Proxy forcefully failing requests that don\u2019t adhere to the Retry-After limit<\/em><\/span><\/p>\n<p>You\u2019ll be able to resume calling Microsoft Graph after the threshold limit resets.<\/p>\n<p>The Rate Limiting Plugin is highly configurable and allows you to provide values for its core settings such as the rate limit, warning threshold or reset window. By configuring the names of the response headers, you can use it with APIs that use non-standard header names, such as X-RateLimit-x.<\/p>\n<p>With this preset, you will be able to test your application against the rate limiting capabilities of your API and the Developer Proxy will make sure to reach the limits quickly so you can validate the parts of your code that are dealing with this feature.<\/p>\n<p>To learn more about the rate limiting plugin and its configuration options, see the <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-developer-proxy\/wiki\/RateLimitingPlugin\">documentation<\/a>.<\/p>\n<h2>A new OData Paging guidance<\/h2>\n<p>When using an API, calling it in the most efficient way is often key to a great user experience. In this release, we introduce guidance that allows you to identify when you\u2019re iterating through a collection of entities by manually constructing paging URLs, which exposes you to data integrity errors.<\/p>\n<p>The Developer Proxy will inspect responses from the API and validate that you are calling the next page of data while using the @odata.nextLink. If not, the plugin will return a warning with a link to the documentation to help you understand how to use and benefit from the OData paging capabilities.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-4.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-13354\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-4-1024x697.png\" alt=\"Developer Proxy showing a warning about a paging URL being constructed manually.\" width=\"640\" height=\"436\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-4-1024x697.png 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-4-300x204.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-4-768x523.png 768w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2023\/03\/developer-proxy-v6_image-4.png 1100w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 10pt;\"><em>Developer Proxy showing a warning about a paging URL being constructed manually<\/em><\/span><\/p>\n<p>To learn more about the OData paging guidance, see the <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-developer-proxy\/wiki\/ODataPagingGuidancePlugin\">documentation<\/a>.<\/p>\n<h2>Additional improvements<\/h2>\n<h3>Binary responses support in the random error plugin<\/h3>\n<p>To allow supported more varied error responses and scenarios, this release brings support for binary response to <code>GenericRandomErrorPlugin<\/code>. You can now return binary data from a file as part of your mocks. To learn more, see the <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-developer-proxy\/wiki\/Simulate-errors-from-non-Microsoft-365-APIs\">documentation<\/a>.<\/p>\n<h3>Get better support with the client request ID guidance<\/h3>\n<p>Specifically for Microsoft Graph, we want to provide a seamless experience when needing to interact with our support organization. To help this, we have built a plugin that helps ensure that all your requests to Microsoft Graph are decorated with a client-request-id header that helps both your team and our team to identify the faulty calls to our services. To learn more, see the <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-developer-proxy\/wiki\/GraphClientRequestIdGuidancePlugin\">documentation<\/a>.<\/p>\n<h3>Renamed disabled to enabled in our configuration file<\/h3>\n<p>To make our configuration files easier to read, we decided to use positive values instead of negative values to identify boolean settings. In this case we changed <code>disabled to enabled<\/code>. <strong>If you are using a custom configuration file, make sure you change the value as this is a breaking change.<\/strong><\/p>\n<h3>Renamed logLevel to log-level<\/h3>\n<p>To have consistency across our parameters when using our CLI, we renamed <code>logLevel<\/code> to <code>log-level<\/code> to ensure we are using kebab-case rules across all our plugins.<\/p>\n<h2>Try the Developer Proxy v0.6 today<\/h2>\n<p><a href=\"https:\/\/aka.ms\/graph\/proxy\/download\">Download Microsoft Graph Developer Proxy v0.6<\/a> <strong>and check if your apps properly handle API errors.<\/strong><\/p>\n<p>We\u2019re excited about this new version and can\u2019t wait for you to try it out. We\u2019re looking forward to <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-developer-proxy\/wiki\/Get-help-and-support\">hearing from you<\/a> about these improvements and how we can continue to make the Microsoft Graph Developer Proxy even better.<\/p>\n<p>Follow us on <a href=\"https:\/\/twitter.com\/Microsoft365Dev\">@Microsoft365Dev\/Twitter<\/a> to stay up to date on the latest news and announcements.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Build resilient and performant apps with the latest preview version of the Microsoft Graph Developer Proxy. We\u2019re excited to introduce support for monitoring specific processes, rate limiting and more! <\/p>\n","protected":false},"author":69087,"featured_media":13383,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[222],"class_list":["post-13352","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-graph","tag-developer-proxy"],"acf":[],"blog_post_summary":"<p>Build resilient and performant apps with the latest preview version of the Microsoft Graph Developer Proxy. We\u2019re excited to introduce support for monitoring specific processes, rate limiting and more! <\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/13352","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\/69087"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=13352"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/13352\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/13383"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=13352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=13352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=13352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}