Jump to content

refresh a library via api


Recommended Posts

alturismo
Posted

Hi, may im blind but i cannot get a simple refresh via api running

 

i checked the openapi wiki, but all i try is ending with 

 

oot@AlsServer:~# curl -X POST "http://192.168.1.2:8096/emby/Library/Refresh"
<h1>Length Required</h1>root@AlsServer:~# ^C
root@AlsServer:~# 
 
may some hints how the command looks ?
 
usecase here as records are still in "season 1" instead "season 01" (2 digits) i made me a script to move them after i made my com cuts (avysynth) and remux (to .mkv)
 
as emby needs some time to update and sometimes a whole day i d like to automize this with an api call.
 
thanks ahead.
PenkethBoy
Posted

that api call requires authentication

 

go to swagger (look for the "api" link in the bottom of the server dashboard page) and then look for library service

 

within that list you will find the refresh option that you can test to see what the full url should look like

 

Also prior to that make sure you have the realtime monitor turned on for each library (assuming your OS supports it) - and emby will find new media within a couple of minutes and hopefully the api call will not be necessary

alturismo
Posted

thats what i more or less did and always ended up in ...

 

Unable to find the specified file.root@AlsServer:~# ^C
root@AlsServer:~# curl -X POST "http://192.168.1.2:8096/emby/Library/Refresh?api_key=mykeyhere"-H "accept: */*"
<h1>Length Required</h1>root@AlsServer:~# ^C
root@AlsServer:~# 
 
thats what i get from the shell ... i replaced my api key now with "mykeyhere" just in case u think its wrong.
 
and yes, i have realtime running and working for new files, but when i move files with script it aint recognizing it ... only after the nightly refresh ...
PenkethBoy
Posted

where are you getting the key from?

alturismo
Posted

where are you getting the key from?

 

from the swagger site ?

PenkethBoy
Posted

No thats not going to work for you

 

either get it by authenticating with a user/pwd

 

or go to dashboard>advanced>security and generate one

alturismo
Posted

ok, added it there, took that key now, same result ...

 

[1] 7204
root@AlsServer:~# -bash: http://192.168.1.2:8096/openapi:No such file or directory
^C
[1]+  Exit 127                http://192.168.1.2:8096/openapi
root@AlsServer:~# curl -X POST "http://192.168.1.2:8096/emby/Library/Refresh?api_key=newapikey"-H "accept: */*"
<h1>Length Required</h1>root@AlsServer:~# ^C
root@AlsServer:~#
 
replaced key with newapikey
Posted

Have you tried this with the interactive api docs?

Happy2Play
Posted (edited)

Manually trying to run the curl commands I always get the "<h1>Length Required</h1>" error or something similar.   You need to add "-d """ to the command.

curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -H "accept: */*" -d ""
​or
curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -d ""
​or
curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -H  "Content-Length: 0"
Edited by Happy2Play
alturismo
Posted (edited)

 

Manually trying to run the curl commands I always get the "<h1>Length Required</h1>" error or something similar.   You need to add "-d """ to the command.

curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -H "accept: */*" -d ""
​or
curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -d ""
​or
curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -H  "Content-Length: 0"

 

ok, now it looks working, what wonders me a little, i only see pictures updating in dashboard (percentage circle), nothing in tvshows and movies, will try now as a record just got done.

 

### EDIT ###

 

update, worked like a charm, thanks alot ;)

Edited by alturismo
  • 2 months later...
roblav96
Posted (edited)

 

Manually trying to run the curl commands I always get the "<h1>Length Required</h1>" error or something similar.   You need to add "-d """ to the command.

curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -H "accept: */*" -d ""
​or
curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -d ""
​or
curl -X POST "http://localhost:8096/emby/Library/Refresh?api_key=YourAPIKey" -H  "Content-Length: 0"

 

 

ok, now it looks working, what wonders me a little, i only see pictures updating in dashboard (percentage circle), nothing in tvshows and movies, will try now as a record just got done.

 

### EDIT ###

 

update, worked like a charm, thanks alot ;)

 

Might I recommend https://httpie.org/ as a friendly alternative to curl:

http POST 'http://localhost:8096/emby/Library/Refresh?api_key=123456789'
Edited by roblav96
alturismo
Posted

 

Might I recommend https://httpie.org/ as a friendly alternative to curl:

http POST 'http://localhost:8096/emby/Library/Refresh?api_key=123456789'

thanks for the tip, as its all working fine here currently no need, but i keep it in mind ;)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...