1. Get Access Token
Request an access token (valid for 1 year) and save to a temp file:
Write to /tmp/podchaser_request.json:
```json
{
"query": "mutation { requestAccessToken(input: { grant_type: CLIENT_CREDENTIALS, client_id: \"\", client_secret: \"\" }) { access_token token_type expires_in } }"
}
```
Replace and with your actual credentials from the Prerequisites section.
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" -d @/tmp/podchaser_request.json' | jq -r '.data.requestAccessToken.access_token' > /tmp/podchaser_token.txt
```
Store the token for use in subsequent requests.
Verify the token was saved:
```bash
cat /tmp/podchaser_token.txt | head -c 50
```
2. Search Podcasts
Search for podcasts by keyword:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ podcasts(searchTerm: \"technology\", first: 5) { paginatorInfo { count } data { id title description author { name } } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
3. Get Podcast Details
Get detailed information about a specific podcast by ID:
> Note: The type field is required in the identifier. Use PODCHASER for Podchaser IDs, APPLE_PODCASTS for Apple IDs, or SPOTIFY for Spotify IDs.
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ podcast(identifier: { id: \"717178\", type: PODCHASER }) { id title description url imageUrl language ratingAverage ratingCount author { name } categories { title } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
4. Search Episodes
Search for episodes across all podcasts:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ episodes(searchTerm: \"AI\", first: 5) { paginatorInfo { count } data { id title description airDate length podcast { title } } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
5. Get Podcast Episodes
Get episodes for a specific podcast:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ podcast(identifier: { id: \"717178\", type: PODCHASER }) { id title episodes(first: 10) { data { id title description airDate length } } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
6. Get Episode Details
Get detailed information about a specific episode:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ episode(identifier: { id: \"789012\", type: PODCHASER }) { id title description airDate length url imageUrl podcast { id title } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
7. Get Podcast Categories
Categories are available as a field on podcast objects. Get categories for a specific podcast:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ podcast(identifier: { id: \"717178\", type: PODCHASER }) { title categories { title slug } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
8. Filter Podcasts by Category
Get podcasts in a specific category:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ podcasts(filters: { categories: [\"technology\"] }, first: 10) { data { id title description ratingAverage } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
9. Get Chart Rankings
Get Apple Podcasts chart data:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ podcasts(filters: { hasAppleChartRank: true }, sort: { sortBy: APPLE_CHART_RANK, direction: ASC }, first: 10) { data { id title appleChartRank } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
10. Get Creator/Host Information
Search for podcast creators:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ creators(searchTerm: \"Joe Rogan\", first: 5) { data { pcid name bio credits { data { podcast { title } } } } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
11. Preview Query Cost
Check how many points a query will cost before executing:
Write to /tmp/podchaser_request.json:
```json
{
"query": "{ podcasts(searchTerm: \"tech\", first: 10) { data { id title description episodes(first: 5) { data { id title } } } } }"
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.podchaser.com/graphql/cost" --header "Content-Type: application/json" --header "Authorization: Bearer $(cat /tmp/podchaser_token.txt)" -d @/tmp/podchaser_request.json'
```
---