Using GraphQL
Introduction
GraphQL is a way of building and accessing APIs that allows for more flexibility and efficiency than traditional REST API endpoints. The REST API paradigm provides many endpoints but no customization within those endpoints, which can lead to over/underfetching data. GraphQL provides only one endpoint, but allows for complete customization over what data is received.
GraphQL gives you exactly what you ask for and does it in a way that is intuitive and efficient.
Accessing Data
You can access our GraphQL endpoint using an HTTP Post Request, shown in the example requests below.
curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR API KEY HERE>" \
--data '{ "query": "{ courseCatalog { nodes { title } } }" }' \
https://paas-api.pluralsight.com/graphql
You can also use the GraphQL Playground to quickly test all available queries and mutations (API Key needed).
For JavaScript/TypeScript usage, there are libraries built for GraphQL integrations. For example, the Graphios library simplifies back-end interactions with GraphQL servers. And the Apollo Client library makes it easy to build UI components that fetch data via GraphQL.
Additional Resources
About GraphQL
GraphQL: The Big Picture
Building Scalable APIs with GraphQL
Comparison of REST and GraphQL
The Fullstack Tutorial for GraphQL
Information about the Apollo Platform
Cursor-Based Pagination
(See Complete Connection Model)