Podcastindex-org / docs-api

Developer documentation for the podcastindex.org api.
https://podcastindex-org.github.io/docs-api/
MIT License
52 stars 29 forks source link

Enhancement - Update docs for /episodes/byfeedid, /episodes/byfeedurl, /episodes/bypodcastguid to include feedUrl, podcastGuid #122

Closed jhhb closed 2 months ago

jhhb commented 3 months ago

Hello -- I'd be happy to work on an update for this, but wanted to log an issue first. I included a script at the bottom that can be used to hit each endpoint and check the responses.

Thanks for any help you can give me, thanks for the great work, and please let me know if this is an update I can take on myself. Thanks!

Expected

Response documentation at this link for /episodes/byfeedurl /episodes/byfeedid /episodes/bypodcastguid includes podcastGuid and feedUrl for the item within the items array, since podcastGuid and feedUrl are returned when calling these endpoints.

Actual

The documentation doesn't include podcastGuid or feedUrl:

no-guid-or-feed-url

Request

Could podcastGuid and feedUrl be added into the docs?

Script for hitting each endpoint to check the responses

This script can be run to hit each of the /episodes/* endpoints to check the responses to see that the values are being returned. The script needs to be run like so, with the required ENV vars:

API_KEY=<redacted> API_SECRET=<redacted> ./script.sh
#!/bin/bash
#Required values

API_HEADER_TIME="$(date +%s)"
# Podcasting 2.0 feed ID and itunes ID
FEED_ID="920666"
ITUNES_ID="1584274529"
FEED_URL='http://mp3s.nashownotes.com/pc20rss.xml'
PODCAST_GUID='917393e3-1b1e-5cef-ace4-edaa54e1f810'

BY_FEED_ID_REQUEST_URL="https://api.podcastindex.org/api/1.0/episodes/byfeedid?id=${FEED_ID}&pretty=true&max=1"
BY_ITUNES_ID_REQUEST_URL="https://api.podcastindex.org/api/1.0/episodes/byitunesid?id=${ITUNES_ID}&pretty=true&max=1"
BY_FEED_URL_REQUEST_URL="https://api.podcastindex.org/api/1.0/episodes/byfeedurl?url=${FEED_URL}&pretty=true&max=1"
BY_PODCAST_GUID_REQUEST_URL="https://api.podcastindex.org/api/1.0/episodes/bypodcastguid?guid=${PODCAST_GUID}&pretty=true&max=1"
# Has values to get Authorization token
HASH="$(echo -n "${API_KEY}${API_SECRET}${API_HEADER_TIME}" | sha1sum | awk '{print $1}')"

# Set required header
HEADERS=(-H "User-Agent: bash-podcastindex-org-example/0.1" -H "X-Auth-Key: ${API_KEY}" -H "X-Auth-Date: ${API_HEADER_TIME}" -H "Authorization: ${HASH}")

# Make request
curl "${HEADERS[@]}"  "${BY_FEED_ID_REQUEST_URL}" > by_feed_id.json
curl "${HEADERS[@]}"  "${BY_ITUNES_ID_REQUEST_URL}" > by_itunes_id.json
curl "${HEADERS[@]}"  "${BY_FEED_URL_REQUEST_URL}" > by_feed_url.json
curl "${HEADERS[@]}"  "${BY_PODCAST_GUID_REQUEST_URL}" > by_podcast_guid.json
stevencrader commented 3 months ago

Thank you for the report. You are welcome to open a PR with the changes. We appreciate your help.

jhhb commented 2 months ago

Welcome, @stevencrader ! I have a PR up for this change at: https://github.com/Podcastindex-org/docs-api/pull/123