Django Graph API Build status on travis-ci Join us on slack at https://slack-djangographapi.now.sh Docs status on readthedocs Python versions from PyPI

Django Graph API lets you quickly build GraphQL APIs in Python. It is designed to work with the Django web framework.

What is GraphQL?

GraphQL is an API query language created by Facebook in 2012 and open-sourced in 2015. Some of its benefits over REST are:

  • getting the data you need and nothing more
  • getting nested fields without extra requests
  • strong typing

For example, if you wanted to get your name and birthday, and the names and birthdays of all of your friends, you could query an API like this:

POST http://myapp/graphql
"{
    me {
        name
        birthday
        friends {
            name
            birthday
        }
    }
}"

And an example JSON response would be:

{
   "me": {
      "name": "Buffy Summers",
      "birthday": "1981-01-19",
      "friends": [
         {
            "name": "Willow Rosenberg",
            "birthday": "1981-08-01"
         },
         {
            "name": "Xander Harris",
            "birthday": null
         }
      ]
   }
}

For an full introduction to GraphQL, you can read the official documentation.

If you have a Github account, you can try out their GraphQL API explorer.

Why Django Graph API?

We see GraphQL as a promising alternative to REST.

In order to increase its usage amongst Python developers, we are trying to create a library that stays up to date with the GraphQL specs and that embraces all of the things we love about Python:

  • simple, readable, and elegant
  • great documentation
  • supportive open-source community

Django Graph API is still a young project and doesn’t yet support many of the key GraphQL features, such as filtering and mutations. See a list of supported and unsupported features.

If you’d like to help contribute, read our contributing guidelines and chat with us on Slack.

Reference Documentation