https://prefect.io logo
Title
l

Lawrence Finn

08/20/2021, 3:12 PM
I would like to communicate with prefect outside of python. Are there graphql definition files I can use to generate clients?
z

Zanie

08/20/2021, 3:19 PM
AFAIK the GraphQL schema can be retrieved from a running server, you just need to query for it. Hasura generates a bunch of the schema. You can see our custom schema at https://github.com/PrefectHQ/server/tree/master/src/prefect_server/graphql/schema but that will exclude the many Hasura queries
l

Lawrence Finn

08/20/2021, 5:50 PM
what headers would i need to pass to authenticate with my api key?
z

Zanie

08/20/2021, 5:52 PM
From the
client
code
if token:
            headers["Authorization"] = "Bearer {}".format(token)

        if self.api_key and self._tenant_id:
            # Attach a tenant id to the headers if using an API key since it can be
            # used accross tenants. API tokens cannot and do not need this header.
            headers["X-PREFECT-TENANT-ID"] = self._tenant_id
If it is the default tenant associated with your key, you do not need to provide the tenant id
Authorization="Bearer {API_KEY}" should be sufficient
l

Lawrence Finn

08/20/2021, 5:54 PM
hmmmm that doesnt seem to work
just via curl i get
ip-192-168-1-152:aiq lawrencefinn$ curl -H"Authorization: Bearer ...."  <https://cloud.prefect.io/aiq/api>
<?xml version='1.0' encoding='UTF-8'?><Error><Code>AuthenticationRequired</Code><Message>Authentication required.</Message></Error>
oh der
im hitting a dumb endpoint
thanks… i get it, should have hit
<https://api.prefect.io/graphql>