@barrenth it is possible to use WPGraphQL as an API that can then fetch data from other sources and return it.
WPGraphQL focuses on exposing data managed in WordPress in the Schema, but there are a lot of APIs that allow you to add Fields and Types to the Schema and you can control how those fields are resolved. The data can come from anywhere!
I have a basic example showing how to fetch data from a remote API and return it here: https://github.com/wp-graphql/wp-graphql-dad-jokes/blob/master/wp-graphql-dad-jokes.php#L20-L34
It’s a simple example, but it shows how to register a field to the Schema, and have it resolve with data from a remote API.
You can see an example of the outcome in the README here: https://github.com/wp-graphql/wp-graphql-dad-jokes#readme
Additionally, you can read up on the different APIs in WPGraphQL for registering fields, types, connections and more: https://www.wpgraphql.com/functions
-
This reply was modified 2 years, 2 months ago by Jason Bahl.