In this article, you will select the GraphQL Request to work with GraphQL. And to work with a specific API, select the appropriate request type as seen below: You can build, design, and test different APIs from a single API client. And while GraphQL API clients - like Playground and GraphiQL - are to GraphQL, what Postman is to REST, Insomnia provides a better alternative by supporting RESTful, GraphQL, and gRPCs APIs. So, because Insomnia supports REST and GraphQL APIs, you can think of it as a sandwich between Postman and GraphiQL. ![]() Additionally, Insomnia features a developer-friendly and easy-to-use GUI, developer collaboration, test automation, and an extensible plugin ecosystem. Thus, making this API client a favorite of many developers. It supports HTTP, GraphQL, gRPC, and WebSocket requests. Insomnia is an API client for designing, debugging, and testing APIs. GraphQL is innovative, and it offers some interesting advantages: You will also need the latest version of Insomnia and Node.js. To follow along with this article, you will need a basic knowledge of GraphQL and with working with APIs and API clients such as Postman, GraphiQL, or Insomnia. In this article, we’ll learn how to debug GraphQL APIs using Insomnia. And in this article, we are interested in the latter. While GraphQL provides official clients for working with GraphQL: Playground and Graphiql, some notable third-party alternatives such as Altair and Insomnia exist. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful dev tools. Debugging GraphQL APIs with InsomniaĪccording to the official documentation, GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. If all has gone to plan you should see something like this in the response panel.Lawrence Eagles Follow Senior full-stack developer, writer, and instructor. Note that I’ve added a query parameter for mode=json and units=imperial. Here’s the full URL (don’t forget to replace your API key) /data/2.5/weather?q=Houston,us&mode=json&units=imperial&APPID=YOUR-API-KEY-HERE To make the request you’ll add the URL to the request at the top of the screen. The request format looks like this: /data/2.5/weather?q= ![]() In order to get weather data for Houston we’ll use the Open Weather Map API for Current Weather Data. Your new request is ready to define the request URL. Let’s name this one “Get City Weather” and the request type will be GET. Once you do, you’ll get a pop-up window to name the request and pick the request method. You can do this by using the shortcut command + N or clicking the plus with the arrow next to the filter bar. The first step is creating a new request. Let’s kick it off by making a simple GET request for weather in Houston. We’ll start with the basics first so you can get a sense of what’s going on before we dive into environments and some of the other features.
0 Comments
Leave a Reply. |