Skip to content

Latest commit

 

History

History
79 lines (59 loc) · 1.85 KB

graphql.md

File metadata and controls

79 lines (59 loc) · 1.85 KB
description
Connect Jet Admin to any GraphQL API

GraphQL

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
      }
    }
  }
}

1. Add your GraphQl resource

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.

2. Make a request

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 %}