Owanesh / breakingbad_graphqlapi

GraphQL APIs about BreakingBad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BreakingBad API in GraphQL

Preface | This repo has only purpose to make experiments with GraphQL by Strawberry. Dataset is retrieved from BreakingBad Api.

Install dependencies

poetry install

Start the server

cd breakingbad/
poetry run strawberry server breakingbad

Play with payloads!

Basic query

Retrieve all characters

{
  characters {
    items {
      name
      nickname
      occupation
    }
  }
}

All episodes with extra information on characters

{
  episodes {
    items {
      title
      season
      series
      characters {
        name
        nickname
      }
    }
  }
}

Filtering

{
  deaths(responsible:{nickname: "Heisenberg"}) {
    items{
      death
      cause
    }
  }
}

Pagination

Preface | Pagination technique used is "Cursor Pagination" to obtain more performance and readability than Connection type skipping edge nodes

  • after indicates the offset of query. [ after must be >= 0 ]
  • first indicate the number of results after after element do you want [ after must be set if you use first ]
{
  deaths(after:2,first:4) {
    next
    items{
      deathId
      cause
      death
      lastWords
      responsible
    }
  }
}

About

GraphQL APIs about BreakingBad


Languages

Language:Python 100.0%