You may have heard of GraphQL, a young and fast-growing API architecture style that is becoming increasingly popular among developers. Although REST remains dominant and some developers may be hesitant to use an unfamiliar architecture, GraphQL has seen wide adoption in data-heavy industries, such as e-commerce.
But what exactly is GraphQL? Simply put, it’s a query language for APIs, designed to give users more flexibility and efficiency when retrieving data. In this article, we’ll explore the benefits of using GraphQL over REST for weather APIs and provide examples of how to make requests to Meteum API.
According to Postman’s State of the API 2022 report, GraphQL is one of the top four architectural styles of API, with 28% of developers using it. Compare that to 24% in 2021, or to 22.5% in 2020: GraphQL is picking up pace year by year. We’re confident this number will continue to grow, and there are numerous reasons for it.
To illustrate them, here’s an example using mock parameters. We’re requesting forecasting data for New York City for five days. Let’s say we’re specifically interested in temperature and humidity and want to see both the current and the daily forecast. With REST, we’d need to specify these parameters as query parameters, which would result in an unwieldy URL: