Back to VS Code home
GraphQL is an open-source data querying and manipulation language for APIs. While you develop a GraphQL service, you need to try it and debug it to check how it works.
The Ballerina VS Code extension provides the GraphQL Try it view, which gives the ability to try GraphQL services within VS Code instead of using any third-party software.
Write the GraphQL service
Add the code below to the
main.bal file of your Ballerina project.
Try the GraphQL service
Once you add the above function, the VS Code extension will display a CodeLens called Try it on top of the service.
Click the Run CodeLens to run the program.
Info: This opens the terminal and starts running the service.
Click the Try it CodeLens to open the GraphQL Try it view.
Note: The service must be in the running state to use GraphQL Try it view.
Once the GraphQL view is opened, click Explorer to open the Explorer view.
Tip: You can find all the available APIs from the side menu that opens.
Select the APIs that you want to try from the Explorer menu.
Info: This will automatically generate the payload in the editor. You can edit the payload and add the required parameters (e.g., type your name under the name parameter). Click Prettify to format the code.
Click Run to send the request.
Info: The response gets displayed in the right-side window.