Database Structure Explained

Hi

I would like to query the Sonarr db to get all the shows ,their seasons and where each file is listed .

I just can seem to figure out the table structure and how it all fits together. Would some one be able to help me out with the query or explain to me how the tables are related to one another . When I looked at it I could not figure out how it lined up at all .

Series table has all the series with the seasons stored in JSON (makes querying difficult on the seasons, but works well when in memory).

Episodes has all the episodes for all the series.

EpisodeFiles has all the files on disk.

Episodes have an EpisodeFileId that links to the corresponding EpisodeFile, more than one episode can be linked to an EpisodeFile (they will have the same ID).

Episodes and EpisodeFiles both have SeriesId that link back to the series.

The database can change at any time and you would be better off using the API if you want to get the information in a consistent way, get the list of series and the episodes/episode files like the UI does.

Thank , I just wanted to know how would i call the api from a browser this does not work . http://10.0.0.4:8087/api/series &apikey=4d128ef57840b434c9cdf9ec3c2e6ba7c . It just says “error”: “Unauthorized”

http://10.0.0.4:8087/api/series?apikey=4d128ef57840b434c9cdf9ec3c2e6ba7c

The first parameter needs to be preceeded by a ?, any additional ones need to be preceeded by &.

Thanks it is working now