description |
---|
Connect Jet Admin to any GraphQL API |
GraphQL is an API design architecture that takes a different, more flexible approach. The key difference between GraphQL vs REST is that GraphQL doesn’t deal with dedicated resources. Instead, everything is regarded as a graph implying it’s connected.
What this means in practical terms is that you can tailor your request to match your exact requirements using the GraphQL query language. In addition to this, it lets you combine different entities into a single query.
A GraphQL query for a movie listings app might look something like this:
{
characters {
results {
id
name
status
species
type
gender
origin {
name
id
}
}
}
}
To connect GraphQL to JetAdmin, add a new resource from the settings and select GraphQL or select GraphQL as the resource when creating a new project.
Then, enter your API endpoint in the Base URL field. Base URL example:
https://rickandmortyapi.com/graphql
Depending on your API authentication settings, you may need to enter URL parameters or headers, or set the method via the Authentication dropdown.
You can display the results of GraphQL queries as with any other query in Jet Admin.
{
characters {
results {
id
name
status
species
type
gender
origin {
name
id
}
}
}
}
More information about HTTP Requests in our documentation.
{% content-ref url="../data/make-an-http-request.md" %} make-an-http-request.md {% endcontent-ref %}