New VSCode extension for autocompleting your Microsoft Graph APIs

Published Mar 24 2021 03:49 AM 2,177 Views

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.gif

 

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

 

Screenshot 2021-03-23 at 21.04.10.png

 

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

 

Screenshot 2021-03-23 at 21.04.25.png

 

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 - Visual Studio Marketplace

 

Screenshot 2021-03-24 at 08.30.52.png

 

Let me know how you would use it and feel free to contribute to the project MS Graph Completion - GitHub Repository.

 

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

%3CLINGO-SUB%20id%3D%22lingo-sub-2231013%22%20slang%3D%22en-US%22%3ENew%20VSCode%20extension%20for%20autocompleting%20your%20Microsoft%20Graph%20APIs%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2231013%22%20slang%3D%22en-US%22%3E%3CP%3EWhile%20working%20on%20a%20project%20which%20uses%20Microsoft%20Graph%20APIs%2C%20I%20found%20myself%20opening%20the%20Microsoft%20Graph%20Explorer%20a%20lot%20to%20check%20which%20paths%2Fparameters%20were%20available.%20The%20Microsoft%20Graph%20Explorer%20is%20a%20great%20tool%2C%20but%20I%20love%20not%20to%20change%20context%20too%20much.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20I%20like%20to%20create%20Visual%20Studio%20Code%20extensions%2C%20I%20did%20not%20have%20to%20think%20long%20to%20start%20building%20a%20new%20extension.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--497502351%22%20id%3D%22toc-hId--497502351%22%3EBackground%20info%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20good%20news%20for%20me%20was%20that%20Microsoft%20Graph%20Explorer%20has%20an%20API%20for%20retrieving%20the%20Open%20API%20information.%20This%20API%20returns%20all%20the%20available%20endpoints%20and%20their%20parameters%20per%20path.%20All%20I%20had%20to%20do%2C%20was%20create%20the%20logic%20to%20know%20when%20you%20are%20writing%20a%20Microsoft%20Graph%20URL%20and%20call%20the%20API%20to%20provide%20the%20suggestions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1990010482%22%20id%3D%22toc-hId-1990010482%22%3EThe%20extension%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26gt%3B%20%3CSTRONG%3EInfo%3C%2FSTRONG%3E%3A%20The%20Visual%20Studio%20Code%20extension%20can%20be%20found%20on%20the%20marketplace%3A%26nbsp%3B%3CA%20title%3D%22MS%20Graph%20Completion%22%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Deliostruyf.vscode-msgraph-autocomplete%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMS%20Graph%20Completion%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20initial%20version%20of%20the%20extension%20supports%20the%26nbsp%3B%3CSTRONG%3EGET%3C%2FSTRONG%3E%20API%20paths%2C%20query%20string%20parameters%2C%20and%20their%20values.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22how-it-works.gif%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F266529i28CE768D65E0815B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22how-it-works.gif%22%20alt%3D%22how-it-works.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20%3CSTRONG%3E%2Fusers%2F%3C%2FSTRONG%3E%20API%20completion%20allows%20you%20to%20add%20a%26nbsp%3B%3CSTRONG%3E%7Buser-id%7D%3C%2FSTRONG%3E%20token.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-03-23%20at%2021.04.10.png%22%20style%3D%22width%3A%20572px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F266530iB206E3BFEE687C90%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-03-23%20at%2021.04.10.png%22%20alt%3D%22Screenshot%202021-03-23%20at%2021.04.10.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20providing%20your%20user-ID%20or%20username%2C%20it%20will%20automatically%20tokenize%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-03-23%20at%2021.04.25.png%22%20style%3D%22width%3A%20989px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F266531iC189F389E148D119%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-03-23%20at%2021.04.25.png%22%20alt%3D%22Screenshot%202021-03-23%20at%2021.04.25.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-182556019%22%20id%3D%22toc-hId-182556019%22%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EWhen%20would%20you%20use%20it%3F%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EThere%20are%20various%20reasons%20for%20this.%20My%20reasoning%2C%20as%20mentioned%2C%20was%20to%20know%20which%20parameters%20are%20available%20for%20selecting%20and%20expanding%20quickly.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EAnother%20option%20could%20be%20to%20use%20it%20in%20combination%20with%20the%20popular%26nbsp%3B%3CA%20class%3D%22editor-rtfLink%22%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dhumao.rest-client%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EREST%20Client%20-%20Visual%20Studio%20Marketplace%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-03-24%20at%2008.30.52.png%22%20style%3D%22width%3A%20600px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F266588i843F4CF97B05BBF0%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-03-24%20at%2008.30.52.png%22%20alt%3D%22Screenshot%202021-03-24%20at%2008.30.52.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3ELet%20me%20know%20how%20you%20would%20use%20it%20and%20feel%20free%20to%20contribute%20to%20the%20project%26nbsp%3B%3CA%20title%3D%22MS%20Graph%20Completion%20-%20GitHub%20Repository%22%20href%3D%22https%3A%2F%2Fgithub.com%2Festruyf%2Fvscode-msgraph-autocomplete%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMS%20Graph%20Completion%20-%20GitHub%20Repository%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E*Thanks%20to%20the%20Microsoft%20Graph%20team%20for%20the%20API%20and%20Graph%20explorer*%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2231013%22%20slang%3D%22en-US%22%3E%3CP%3EMS%20Graph%20Completion%3A%26nbsp%3B%3CSPAN%3EThe%20VSCode%20extension%20that%20allows%20you%20to%20auto-complete%20the%20Microsoft%20Graph%20API%20URLs%20you%20are%20writing.%20You%20get%20the%20most%20useful%20Microsoft%20Graph%20Explorer%20functionality%20in%20your%20favorite%20editor.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2231013%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExtensions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Graph%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EVSCode%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Mar 24 2021 12:37 AM
Updated by: