Using Our API in Your Project

If you have not used a GraphQL API before, we recommend reviewing at least the first few pages of the GraphQL tutorial on graphql.org to get familiar with the terminology and concepts.

It is strongly encouraged you use a GraphQL client-side library for your language. You can browse the available libraries on graphql.org's code page. Since GraphQL has special formatting and headers, you cannot send off a normal POST request easily like you would with a REST API. However, by using a library, you would be able to craft your query and then let the library handle all the GraphQL-specific parts.

We will be updating this page as we have more language-specific examples.

Python

For integrating from a project using Python, we recommend installing the python-graphql-client library. Then, you can pass any query or mutation you create (or copy from any of our guides) to the GraphqlClient.

For example, in order to use our API, you must first get an access token (see our getting started guide for details on that).

To do this in Python using python-graphql-client, you can copy our example for access tokens from that guide as the query like in this example:

from python_graphql_client import GraphqlClient
# Create your query or mutation.
query = """
mutation {
requestAccessToken(
input: {
grant_type: CLIENT_CREDENTIALS
client_id: "YOUR_ID"
client_secret: "YOUR_SECRET"
}
) {
access_token
}
}
"""
# Execute the GraphQL call using our API's endpoint and your query.
response = GraphqlClient(endpoint="https://api.podchaser.com/graphql").execute(query=query)
# Access the returned data.
access_token = response['data']['requestAccessToken']['access_token']