Imagine you'd like to access Data from multiple APIs and combine the results into a single dataset. WunderGraph supports a rich set of DataSources, so we wanted to add a simple way to achieve JOINs across APIs.
Example: Joining Capitals with Weather Data
Let's say we want to get the weather data for all capitals of a continent. You'd probably want to add two APIs to your application, one to query the capitals and the other to query the weather data.
Next, let's define our JOIN query.
The response looks like this:
The "Magic" behind the JOIN
WunderGraph first queries the countries API to get all the countries of a continent. Then, it queries the weather API for each capital of the countries.
_join field is a special field that exists on every object type. It simply returns the Query type, so you can join a response of one API with another.