GraphQL is a query language and specification for APIs that provides a complete and understandable description of the API's data. GraphQL comes with some superior capabilities compared to traditional REST APIs. Its main features are ask for what you need and get exactly that. We have to specify which fields we want from the API and then we'll only get those in return.
As we can see in the image, When requesting a hero, we might just want to fetch its name, height, and or mass. So we will be 100% efficient when sending data to the network, avoiding what we call over-fetching, getting exactly what we need, nothing more and nothing less. Get many resources in a single request. GraphQL allows us to easily fetch one or multiple resources with related resources in only one single request.
While with typical REST API, we are usually forced to fetch additional resources through multiple requests. Using GraphQL, we don't have to write complex client logic to make the several requests such as handle retries, timeouts, parallel execution, and parse responses. GraphQL can be quick, even on slow mobile network connections. Describe what's possible with a type system.
GraphQL APIs are organized in terms of types and fields, not endpoints. Imagine the types as resources, like for instance, a user or a post, while the fields are the available data within a resource type. For instance, a post can have a title, author, and the post post itself. Due to the explicit declaration, GraphQL APIs are automatically self-documented and always up to date.
It also means that will get helpful error messages, and that we can introspect the API, meaning that we can explore all the API types available in Handy DevTools. Move faster with powerful developer tools. GraphQL makes it easy to build powerful tools like GraphiQL, a graphical interactive in-browser IDE to explore and test GraphQL APIs. We will discover and learn the GraphQL fundamentals with GraphiQL over the next lesson.
Evolve your API without versions. Don't require breaking changes to the clients that are consuming APIs with any new change. Unlike REST APIs that usually follow root versioning models, GraphQL allows you to evolve the API without the need of releasing new versions. As you can see in the image, we're able to add new fields, deprecate them getting a warning message when asking for such data, and remove them safely whenever that field is not being requested anymore.
Who's using GraphQL? Facebook created GraphQL. The GraphQL specification was open-sourced few years later, and the GraphQL Foundation was recently announced. GraphQL is now available in many environments and used by teams of all sizes with a strong and active open-source community.
All these features, among others, make GraphQL the present and future of a specification to build APIs. GraphQL has the standards capabilities as well as the community to power and support the data needs that modern applications require nowadays. GraphQL is a query language and specification for APIs that provides a complete and understandable description of the API's data. GraphQL comes with some superior capabilities compared to traditional REST APIs.
Its main features are ask for what you need and get exactly that. We have to specify which fields we want from the API and then we'll only get those in return. As we can see in the image, When requesting a hero, we might just want to fetch its name, height, and or mass. So we will be 100% efficient when sending data to the network, avoiding what we call over-fetching, getting exactly what we need, nothing more and nothing less.
Get many resources in a single request. GraphQL allows us to easily fetch one or multiple resources with related resources in only one single request. While with typical REST API, we are usually forced to fetch additional resources through multiple requests. Using GraphQL, we don't have to write complex client logic to make the several requests such as handle retries, timeouts, parallel execution, and parse responses.
GraphQL can be quick, even on slow mobile network connections. Describe what's possible with a type system. GraphQL APIs are organized in terms of types and fields, not endpoints. Imagine the types as resources, like for instance, a user or a post, while the fields are the available data within a resource type.
For instance, a post can have a title, author, and the post post itself. Due to the explicit declaration, GraphQL APIs are automatically self-documented and always up to date. It also means that will get helpful error messages, and that we can introspect the API, meaning that we can explore all the API types available in Handy DevTools. Move faster with powerful developer tools.
GraphQL makes it easy to build powerful tools like GraphiQL, a graphical interactive in-browser IDE to explore and test GraphQL APIs. We will discover and learn the GraphQL fundamentals with GraphiQL over the next lesson. Evolve your API without versions. Don't require breaking changes to the clients that are consuming APIs with any new change.
Unlike REST APIs that usually follow root versioning models, GraphQL allows you to evolve the API without the need of releasing new versions. As you can see in the image, we're able to add new fields, deprecate them getting a warning message when asking for such data, and remove them safely whenever that field is not being requested anymore. Who's using GraphQL? Facebook created GraphQL.
The GraphQL specification was open-sourced few years later, and the GraphQL Foundation was recently announced. GraphQL is now available in many environments and used by teams of all sizes with a strong and active open-source community. All these features, among others, make GraphQL the present and future of a specification to build APIs. GraphQL has the standards capabilities as well as the community to power and support the data needs that modern applications require nowadays.