The following pages offer some ideas and examples for automating tasks or integrating tools with Ghostwriter for reporting or tracking infrastructure. Most examples will default to using Python’s gql library, build upon the template you may have seen in the introduction to the GraphQL API, and assume you have an API token.

This template is a good starting point for building automation or experimenting with the API. It includes logging and pulling information like your API token and Ghostwriter URL from a config file.

Here is an example template for a config file you might use to store secrets and other variables:

You need three libraries to run the script: