trakt / api-help

Trakt API docs at https://trakt.docs.apiary.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

/sync/history not_found response for an episode is either an episode or series object?

SenorSmartyPants opened this issue · comments

I want to confirm this is the designed behavior. If I try to add to history an episode with IDs that is not found I get a response with not_found with an episode media object. This is as I expect. (see first example) .

If I try to add an episode with no IDs and include the show and episode with just season/episode numbers, the not found returns a series/season/episode structure under the episodes element. This seems to make sense to me, since the episode has no IDs, but was also a little jarring when I first encountered it.

Add episode with IDs to history

{
   "Episodes":[
      {
         "WatchedAt":"2022-07-09T21:01:05.2010000Z",
         "Ids":{
            "Tvdb":"9170201",
            "Imdb":"tt15783698",
         }
      }
   ]
}

Response

{
   "added":{
      "movies":0,
      "episodes":0
   },
   "not_found":{
      "movies":[
         
      ],
      "shows":[
         
      ],
      "seasons":[
         
      ],
      "episodes":[
         {
            "watched_at":"2022-07-09T21:26:48.8710000Z",
            "season":0,
            "number":0,
            "ids":{
               "tvdb":"9170201",
               "imdb":"tt15783698"
            }
         }
      ],
      "people":[
         
      ],
      "users":[
         
      ]
   }
}

Add episode with NO IDs to history

{
   "Shows":[
      {
         "WatchedAt":null,
         "Seasons":[
            {
               "WatchedAt":null,
               "Episodes":[
                  {
                     "WatchedAt":"2022-07-09T21:01:05.2010000Z",
                     "Season":0,
                     "Number":45,
                     "Title":null,
                     "Ids":null
                  }
               ],
               "Number":0,
               "Ids":null
            }
         ],
         "Title":"South Park",
         "Year":1997,
         "Ids":{
            "Tvdb":"75897",
            "Tvrage":"5266",
            "Imdb":"tt0121955",
            "Tmdb":2190,
            "Trakt":null,
            "Slug":null
         }
      }
   ]
}

Response with series/season/episode under the not_found/episodes

{
   "added":{
      "movies":0,
      "episodes":0
   },
   "not_found":{
      "movies":[
         
      ],
      "shows":[
         
      ],
      "seasons":[
         
      ],
      "episodes":[
         {
            "seasons":[
               {
                  "episodes":[
                     {
                        "watched_at":"2022-07-09T21:26:48.8710000Z",
                        "season":0,
                        "number":45
                     }
                  ],
                  "number":0
               }
            ],
            "title":"South Park",
            "year":1997,
            "ids":{
               "tvdb":"75897",
               "tvrage":"5266",
               "imdb":"tt0121955",
               "tmdb":2190
            }
         }
      ],
      "people":[
         
      ],
      "users":[
         
      ]
   }
}

I see what you mean. It's returning like that since the show and season were found, but the episode wasn't. When something isn't found it just dumps the original JSON that was sent without any processing. I agree it's confusing, but I'm not sure how I could change it to be more clear, since it technically is an issue with the episode itself.