Skip to content
Kellerman81 edited this page Dec 22, 2021 · 1 revision

API Examples

To make it easier all API Calls here are listed with IP 192.168.1.10 Port 9090 and APIKEY mysecure - you have to replace all 3 with your values

For a complete list of API Calls open the following in the browser:

http://192.168.1.10:9090/swagger/index.html

Here some API examples. - All Scripting Examples are Powershell examples

Starting Jobs on request

Jobname can be one of: data, datafull, structure, checkmissing, checkmissingflag, checkreachedflag, feeds, rss, searchmissinginc, searchupgradeinc, searchmissingfull, searchupgradefull, searchmissinginctitle, searchupgradeinctitle, searchmissingfulltitle, searchupgradefulltitle

http://192.168.1.10:9090/api/movies/job/'jobname'?apikey=mysecure http://192.168.1.10:9090/api/series/job/'jobname'?apikey=mysecure

Refresh Metadata

http://192.168.1.10:9090/api/movies/all/refresh?apikey=mysecure - Refresh 100 Movie Metadata http://192.168.1.10:9090/api/movies/all/refreshall?apikey=mysecure - Refresh all Movie Metadata http://192.168.1.10:9090/api/movies/all/refresh/:id?apikey=mysecure - Refresh specific Movie Metadata http://192.168.1.10:9090/api/series/all/refresh?apikey=mysecure - Refresh 20 Series Metadata http://192.168.1.10:9090/api/series/all/refreshall?apikey=mysecure - Refresh all Series Metadata http://192.168.1.10:9090/api/series/all/refresh/:id?apikey=mysecure - Refresh specific Serie Metadata

Clear DB Table

For table names take a look at the database

http://192.168.1.10:9090/api/db/clear/'tablename'?apikey=mysecure - Method: Delete!

List Unmatched media in your library

http://192.168.1.10:9090/api/movies/unmatched?apikey=mysecure http://192.168.1.10:9090/api/series/unmatched?apikey=mysecure

Search for releases for a specific Movie/Episode

http://192.168.1.10:9090/api/movies/search/id/:id?apikey=mysecure - Search and download best available release http://192.168.1.10:9090/api/movies/search/list/:id?apikey=mysecure - Only list accepted and rejected releases

http://192.168.1.10:9090/api/series/search/id/:id?apikey=mysecure - Search and dl episode by series list id (search complete series including Season 0/Specials) (Searches for missing and upgrades!) http://192.168.1.10:9090/api/series/search/id/:id/:season?apikey=mysecure - Search and dl episode by series list id (search complete series season) (Searches for missing and upgrades!) http://192.168.1.10:9090/api/series/episodes/search/id/:id?apikey=mysecure - Search and dl episode by episode list id (search single episode) (Searches for missing and upgrades!)

Rebuild IMDB Cache

http://192.168.1.10:9090/api/fillimdb?apikey=mysecure

Database Maintenance

http://192.168.1.10:9090/api/db/vacuum?apikey=mysecure - Vacuum Database (make smaller) http://192.168.1.10:9090/api/db/backup?apikey=mysecure - Backup Database into Backup folder http://192.168.1.10:9090/api/db/integrity?apikey=mysecure - Test Database Integrity

Check Scheduled Jobs

(Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/scheduler/list?apikey=mysecure" -Method get) | select jobname, ScheduleString, LastRun, NextRun | sort jobname

Check current Job queue

(Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/queue?apikey=mysecure" -Method get) | select Queue, Name, Started | Sort Queue, Started   

History:

(Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/queue/history?apikey=mysecure" -Method get) | select @{n='Name';exp={$_.JobType+"_"+$_.JobCategory+"_"+$_.JobGroup}}, @{n='started';exp={$_.started.Time}}, @{n='Runtime';exp={NEW-TIMESPAN –Start $_.started.Time -End $_.ended.Time}} | sort started

Test Naming for Structure

for cfg_Media use movie_'groupname' or serie_'groupname'

for grouptype use movie or series

$json = '{
  "cfg_Media": "movie_EN",
  "filePath": "/movies/some movie/some movie.avi",
  "grouptype": "movie",
  "movieid": 11278
}'

Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/naming?apikey=mysecure" -Method post -Body $json

$json = '{
  "cfg_Media": "serie_EN",
  "filePath": "/series/2 Broke Girls/Season 1/2 Broke Girls - S01E19 - And the Spring Break.mkv",
  "grouptype": "series",
  "serieid": 169
}'

Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/naming?apikey=mysecure" -Method post -Body $json | fl

Test Parsing of files or strings

  • name: String to parse
  • path: File to parse
  • typ: series or movie
  • year: true/false is a year in the title
  • config: Name of the group it belongs to
  • quality: Name of the quality to use for parsing
$body = @{
    "name" = "series - S01E01 - title - 480P DVDRIP XVID - proper"
    "typ" = "series"
    "year" = $false
    "config" = "EN"
    "quality" = "SD"
}
$a = Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/parse/string?apikey=mysecure" -Method post -Body ($body | ConvertTo-Json) #Parses a string (for testing)

$body = @{
    "path" = "/media/serie - S01E01 - title - 480P DVDRIP XVID.mp4"
    "typ" = "series"
    "year" = $false
    "config" = "EN"
    "quality" = "SD"
}
$a = Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/parse/file?apikey=mysecure" -Method post -Body ($body | ConvertTo-Json) #Parses a file (for testing)

Manually Structure a folder

  • folder: The Root folder where the media file is in
  • sourcepathtemplate: Name of the template of the source path
  • targetpathtemplate: Name of the template of the target path
  • grouptype: movie or series
  • configentry: Name of the group it belongs to
  • disableruntimecheck: true/false - Disable Runtime Check if enabled
  • Disabledeletewronglanguage: true/false - Disable delete wrong language (doesn't allow a wrong language import!)
  • forceid: Id of Movie or episode to skip the parsing
$json = '{
  "folder": "/toimport/some video.XviD",
  "sourcepathtemplate": "en movies import",
  "grouptype": "movie",
  "targetpathtemplate": "en movies",
  "configentry": "EN",
  "disableruntimecheck": true,
  "disabledisallowed": false,
  "forceid": 0
}'

Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/structure?apikey=mysecure" -Method post -Body $json | fl

Update Qualities to use regex

$a = Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/quality?apikey=mysecure" -Method get
$a | foreach {
    $_.UseRegex = $true
    Invoke-RestMethod -Uri "http://192.168.1.10:9090/api/quality?apikey=mysecure" -Method post  -Body ($_ | ConvertTo-Json)
}

Clone this wiki locally