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

Podcasts byFeedId Endpoint bug #104

Open radmakr opened 1 year ago

radmakr commented 1 year ago

I'm not sure if this is the best repo to open this ticket on? This may not be a bug, but it makes working with the API in Swift a little bit annoying. When hitting this endpoint, https://api.podcastindex.org/api/1.0/podcasts/byfeedid with an id that does not exist I believe that the response feed should be null and not an empty array. When you pass a feed ID that does exist feed returns a podcast object and not an array.

if you have a good reason for the current implementation then I can make changes to my Swift code. Thanks

Here is an example of a request with an ID that does not exist,

{
  "status": "true",
  "query": {
    "id": "3454543656564"
  },
  "feed": [],
  "description": "No feeds match this id."
}

and a request with an ID that exists,

{
  "status": "true",
  "query": {
    "id": "41504"
  },
  "feed": {
    "id": 41504,
    "podcastGuid": "856cd618-7f34-57ea-9b84-3600f1f65e7f",
    "title": "No Agenda",
    "url": "http://feed.nashownotes.com/rss.xml",
    "originalUrl": "http://feed.nashownotes.com/rss.xml",
    "link": "http://noagendashow.com",
    "description": "A show about politics with No Agenda, by Adam Curry and John C. Dvorak",
    "author": "Adam Curry & John C. Dvorak",
    "ownerName": "Adam Curry",
    "image": "https://noagendaassets.com/enc/1684705257.13_na-1557-art-feed.png",
    "artwork": "https://noagendaassets.com/enc/1684705257.13_na-1557-art-feed.png",
    "lastUpdateTime": 1684708948,
    "lastCrawlTime": 1684876202,
    "lastParseTime": 1684876228,
    "lastGoodHttpStatusTime": 1684876202,
    "lastHttpStatus": 200,
    "contentType": "text/xml; charset=UTF-8",
    "itunesId": 269169796,
    "itunesType": "episodic",
    "generator": "Sovereign Feeds",
    "language": "en",
    "explicit": true,
    "type": 0,
    "dead": 0,
    "chash": "bfdd6c15e26750f5dd2b14af6398dbbd",
    "episodeCount": 27,
    "crawlErrors": 0,
    "parseErrors": 0,
    "categories": {
      "55": "News",
      "59": "Politics",
      "16": "Comedy"
    },
    "locked": 1,
    "imageUrlHash": 2971684293,
    "value": {
      "model": {
        "type": "lightning",
        "method": "keysend",
        "suggested": "0.00000005000"
      },
      "destinations": [
        {
          "name": "Value4Value",
          "type": "node",
          "address": "03ae9f91a0cb8ff43840e3c322c4c61f019d8c1c3cea15a25cfc425ac605e61a4a",
          "split": 58
        },
        {
          "name": "Clip Custodian (LNpay.co)",
          "type": "node",
          "address": "02a128c92baf0ede00ed0fc3720a92ba2c6392e0b58aa4decab1d787a666d94cb7",
          "split": 20,
          "customKey": "112111100",
          "customValue": "wal_aMZ509T2lnpWvN"
        },
        {
          "name": "Boostagram V4V Monitor",
          "type": "node",
          "address": "038399372001f2741d58d6ec4846fccb78daa1a485e69e2eebc5aadba047d35956",
          "split": 5
        },
        {
          "name": "Dreb Scott (Chapter Architect)",
          "type": "node",
          "address": "02453e4e93322d60219808c00c2e6d1f1c673420e95b5511a33c40cfb4df5e9148",
          "split": 5
        },
        {
          "name": "Geoff Smith - Various Original Songs",
          "type": "node",
          "address": "030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3",
          "split": 5,
          "customKey": "696969",
          "customValue": "mXbAWPOMXmz866ZUJv29"
        },
        {
          "name": "Sovereign Feeds",
          "type": "node",
          "address": "030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3",
          "split": 5,
          "customKey": "696969",
          "customValue": "eChoVKtO1KujpAA5HCoB"
        },
        {
          "name": "Fountain Boosts",
          "type": "node",
          "address": "0332d57355d673e217238ce3e4be8491aa6b2a13f95494133ee243e57df1653ace",
          "split": 1,
          "customKey": "112111100",
          "customValue": "wal_GJWRnH1vp88Uf"
        },
        {
          "name": "Stats",
          "type": "node",
          "address": "030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3",
          "split": 1,
          "customKey": "696969",
          "customValue": "gq0Z8b1wEftMkFL4vj7E"
        }
      ]
    },
    "funding": {
      "url": "https://dvorak.org/na",
      "message": "Support the Show!"
    }
  },
  "description": "Found matching feeds."
}
stevencrader commented 1 year ago

We had something similar in #98. Add to Dave's TODO

radmakr commented 1 year ago

Is there a repo I should add this issue to or will Dave see it here?

daveajones commented 1 year ago

It’s on my to do list for after the database upgrade.

daveajones commented 1 year ago

As a side-note, this happens because of PHP's json_encode which sometimes requires some hoops to get it to output the exact JSON that is wanted.