Your First Podchaser Query

Just getting started with the API? Let's take a look at how you can interact with it.

For all of our queries and mutations, you will be making a POST request to our https://api.podchaser.com/graphql endpoint.

A great way to start exploring the API is using a tool such as Postman. If using Postman, be sure to set the body type to GraphQL.

Getting Your Access Token

Before you can make any queries, you will need to get your access token.

To get your token, you will use the requestAccessToken mutation as shown below. The access tokens last 1 year so you should store this token so you do not need to request new tokens with each query.

POST https://api.podchaser.com/graphql
mutation {
requestAccessToken(
input: {
grant_type: CLIENT_CREDENTIALS
client_id: "YOURID"
client_secret: "YOURSECRET"
}
) {
access_token
token_type # Optional, will always be "Bearer"
expires_in # Optional, will almost always be 31536000
}
}

Example Response

{
"data": {
"requestAccessToken": {
"access_token": "YOURACCESSTOKEN",
"token_type": "Bearer",
"expires_in": 31536000
}
}
}

Once you have your access token, you will use it as the Bearer Token when interacting with other parts of our API.

Making Your First Query

Now that you have your token, let's do a simple podcasts query to retrieve some recent podcasts. To do so, we will again submit a POST request to https://api.podchaser.com/graphql. This time, we will use the podcasts query.

Many of our queries return a paginated list object that has the returned data inside the data key. You can select any of our podcast attributes by selecting fields within the data object. For now, let's select the title and description fields for some podcasts.

The query will look like this:

POST https://api.podchaser.com/graphql
query {
podcasts {
data {
title,
description
}
}
}

And, we will get a response like this (though shortened here for brevity):

{
"data": {
"podcasts": {
"data": [
{
"title": "Stuff You Should Know",
"description": "If you've ever wanted to know about champagne, satanism, the Stonewall Uprising, chaos theory, LSD, El Nino, true crime and Rosa Parks, then look no further. Josh and Chuck have you covered."
},
...other podcasts...
]
}
}
}

Now that you have your token and a general idea how our queries work, you should review the documentation for some of our main queries in our API reference.

Once you created your queries, you will then want to start writing these in your language using a client-side library. You can find libraries over on the graphql.org language support page.