DEV Community

loading...
Cover image for VSCode extension for autocompleting your Microsoft Graph APIs

VSCode extension for autocompleting your Microsoft Graph APIs

Elio Struyf
Elio Struyf is an independent Engineering Lead working for Valo Intranet, Blogger, and Speaker. Loves stickers - if you want stickers as well, get them at https://pyod.shop.
・2 min read

While working on a project which uses Microsoft Graph APIs, I found myself opening the Microsoft Graph Explorer a lot to check which paths/parameters were available. The Microsoft Graph Explorer is a great tool, but I love not to change context too much.

As I like to create Visual Studio Code extensions, I did not have to think long to start building a new extension.

Background info

The good news for me was that Microsoft Graph Explorer has an API for retrieving the Open API information. This API returns all the available endpoints and their parameters per path. All I had to do, was create the logic to know when you are writing a Microsoft Graph URL and call the API to provide the suggestions.

The extension

Info: The Visual Studio Code extension can be found on the marketplace: MS Graph Completion.

The initial version of the extension supports the GET API paths, query string parameters, and their values.

How it works

The /users/ API completion allows you to add a {user-id} token.

User ID token

When providing your user-ID or username, it will automatically tokenize it.

Retrieving API paths for users

When would you use it?

There are various reasons for this. My reasoning, as mentioned, was to know which parameters are available for selecting and expanding quickly.

Another option could be to use it in combination with the popular rest-client extension.

Using it in combination with the Rest Client in VSCode mentioned by Darrel Miller

Let me know how you would use it.

Thanks to the Microsoft Graph team for the API and Graph explorer

Article first published on eliostruyf.com

Discussion (0)

Forem Open with the Forem app