API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400
Added by M A Ben Amara about 5 years ago
Hi, as my setup was working nicely and sadly not anymore may here someone has a hint what could be wrong
workflow description, i cut the recorded .ts and save my cutted videos as .mkv, so i wrote a script wich then moves them to a new location and update the TVH path by api call
sample update call
curl -s "http://user:[email protected]:9981/api/dvr/entry/filemoved" --data-urlencode "src=/recordings/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.ts" --data-urlencode "dst=/Media/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.mkv"
wich now results in following error
2019-10-09 07:51:38.915 http: 192.168.1.2: HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400
from my tvheadend console the path is correct and there
root@AlsServer:/Media/TVRIPS/Navy CIS_ L.A/Season 10# ls
'Navy CIS_ L.A - S10E15 - Stadt der Engel.mkv'
the old path from the dvr log file is also correct
"filename": "/recordings/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.ts",
so pathes are all correct (old and new)
i have to say i lost my tvheadend config and had to redo all ... the script is untouched (was from my unraid server and still there and working)
auth plain & digest is marked cause thats the only failure i readed up, now im out of ideas what could be the reason its not working anymore ...
may someone has a tipp what could be wrong on the server, the user has all priviledges in user settings, but there is no api settings to set (and i cant remember ever setting up something therefore ...)
Server is the current state HTS Tvheadend 4.3-1811~ge1fb5c025
this setup was working like ~ 1 year before flawlessly ... i would be surprised if just in the time of resetup the api call changed, 400 is a bad request ? so ...
for any ideas, thanks ahead
Replies (14)
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by Joe User about 5 years ago
Nothing has changed for the api in well over a year.
Web permission problems would generate a different error.
Tvheadend checks if it has access to the dst file - so make sure the permissions are ok for your tvheadend user (probably hts..)
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by M A Ben Amara about 5 years ago
thanks for the hint, checked that already, tvh docker has full access, also from docker shell i can read/write to source and destination ...
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by M A Ben Amara about 5 years ago
this is how it looks like when i manually trigger from cmd line, may this response helps ?
root@AlsServer:~# curl -s "http://user:[email protected]:9981/api/dvr/entry/filemoved" --data-urlencode "src=/recordings/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.ts" --data-urlencode "dst=/Media/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.mkv" <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>400 Bad Request</TITLE> </HEAD><BODY> <H1>400 Bad Request</H1> </BODY></HTML> root@AlsServer:~#
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by Joe User about 5 years ago
Joe User wrote:
make sure the permissions are ok for your tvheadend user (probably hts..)
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by M A Ben Amara about 5 years ago
i did that already, but ... thanks for the permission hint, it where the dvr log files wich had wrong perms ...
i have to watch on that what causes it cause they where empty before i resetup and created by tvheadend ...
nvm, at least i have the solution
thanks alot for helping out
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by M A Ben Amara about 5 years ago
may i ask if there is a debug option for the api calls ? cause im stucking here ...
all perms setted here, still facing this issue again ... even now when files are correct i get the same 44 error ...
- EDIT
small addition, when i manually change the file to the correct path and restart tvheadend, the record is back, so ma conclusion is there shouldnt be any dst=... file permission issues cause it can stat the file.
thanks ahead
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by Joe User about 5 years ago
See here: https://tvheadend.org/boards/5/topics/39257?r=39261
you can try to trace "api,http", but there are very few debugging messages for "api".
Be aware that it will generate a lot of messages from the webif, so make sure you are not using it while trying to test.
(hint: this is a good way to see the apis the webif is using.)
Also, the error code returned is not helpful because there is a small bug.
See here: https://tvheadend.org/issues/5743
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by M A Ben Amara about 5 years ago
well, thats not really helpful then
may another question, instead using api to update the path i can also use a script and replace it inside the file directly,
may a way to "flush" dvr logs while running ? currently i need a tvheadend server restart to achieve the "update"
thanks ahead
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by M A Ben Amara about 5 years ago
Joe User wrote:
See here: https://tvheadend.org/boards/5/topics/39257?r=39261
you can try to trace "api,http", but there are very few debugging messages for "api".
Be aware that it will generate a lot of messages from the webif, so make sure you are not using it while trying to test.
(hint: this is a good way to see the apis the webif is using.)
Also, the error code returned is not helpful because there is a small bug.
See here: https://tvheadend.org/issues/5743
i tried to add the parameter, --subsystem api, completely unable to login to tvheadend, log stalls at showing subsystems ... so i tried --subsystem:api wich looks wrong formatted, then tried --subsystem api,-all, again stalling ...
running tvheadend in docker enviroment here ...
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by Joe User about 5 years ago
The post I linked to is about setting up debugging through the webif.
the "--subsystems" only prints a list of the subsystems tvheadend was compiled with and then exits.
For command line debug/trace you can use for example:
tvheadend -d --debug http --trace api
"-d" outputs to stderror if you are running from a shell and want to watch
You can also add "-l </path/to/logfile>" to dump all messages to a file.
tvheadend --help
will give you all the command line options.
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by M A Ben Amara about 5 years ago
ok, seems i got it solved ... was my fault with the new docker mounts, case sensitive ... sorry.
thanks for pointing me to the debug options, even it was nothing with api i double checked string by string wich finally ...
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by Joe User about 5 years ago
I briefly thought of that, but you wrote:
M A Ben Amara wrote:
small addition, when i manually change the file to the correct path and restart tvheadend, the record is back, so ma conclusion is there shouldnt be any dst=... file permission issues cause it can stat the file.
So I assumed it was ok. But I guess it is the source file which was causing the problem?
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by Joe User about 5 years ago
BTW - if you (or someone else) wants to compile their own, this small patch I use which was very useful for me when I was trying to resolve similar issues in the past.
diff --git a/src/webui/webui_api.c b/src/webui/webui_api.c index 72d6d359a..3992f8a29 100644 --- a/src/webui/webui_api.c +++ b/src/webui/webui_api.c @@ -40,6 +40,7 @@ webui_api_handler r = EINVAL; goto destroy_args; } + printf(" key: %s val: %s \n", ha->key, ha->val); htsmsg_add_str(args, ha->key, ha->val); }
It just prints out to the console the arguments tvheadend finds and the value it parses it to. It was useful in resolving single and double quote issues with curl/wget.
From your curl command above, you would see something like:
key: src val: /recordings/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.ts key: dst val: /Media/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.mkv 2019-10-15 08:46:23.817 [ TRACE] http: HTTP/1.1 POST /api/dvr/entry/filemoved?src=/recordings/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.ts&dst=/Media/TVRIPS/Navy CIS_ L.A/Season 10/Navy CIS_ L.A - S10E15 - Stadt der Engel.mkv{{Host=192.168.1.13:9981,User-Agent=curl/7.64.0,Accept=*/*,Content-Length=241,Content-Type=application/x-www-form-urlencoded}} 2019-10-15 08:46:23.817 [ ERROR] http: 192.168.1.13: HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 404
(of course the dst dosn't exist on my system)
And for the curious, this is the output from the webif applying new debugging options with trace enabled for "api,http":
2019-10-15 08:46:15.443 [ TRACE] http: HTTP/1.1 POST /api/tvhlog/config/load?meta=1{{Host=192.168.113:9981,Connection=keep-alive,Content-Length=6,Origin=http://192.168.1.13:9981,X-Requested-With=XMLHttpRequest,User-Agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36,Content-Type=application/x-www-form-urlencoded,Accept=*/*,Referer=http://192.168.1.13:9981/extjs.html,Accept-Encoding=gzip, deflate,Accept-Language=en-US,en;q=0.9,Cookie=ys-api/dvr/entry/grid_failed=o%3Acolumns%3Da%253Ao%25253Aid%25253Ds%2525253Adetails%25255Ewidth%25253Dn%2525253A46%255Eo%25253Aid%25253Dn%2525253A1%25255Ewidth%25253Dn%2525253A25%255Eo%25253Aid%25253Dn%2525253A2%25255Ewidth%25253Dn%2525253A206%255Eo%25253Aid%25253Dn%2525253A3%25255Ewidth%25253Dn%2525253A431%255Eo%25253Aid%25253Dn%2525253A4%25255Ewidth%25253Dn%2525253A127%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A5%25255Ewidth%25253Dn%2525253A127%255Eo%25253Aid%25253Dn%2525253A6%25255Ewidth%25253Dn%2525253A127%25255Ehidden%2525 key: node val: {"path":"","enable_syslog":false,"trace":true,"debugsubs":"","tracesubs":"api,http","libav":false}
RE: API Call error --- HTTP/1.1 POST (3) /api/dvr/entry/filemoved -- 400 - Added by M A Ben Amara about 5 years ago
Joe User wrote:
I briefly thought of that, but you wrote:
M A Ben Amara wrote:
small addition, when i manually change the file to the correct path and restart tvheadend, the record is back, so ma conclusion is there shouldnt be any dst=... file permission issues cause it can stat the file.
So I assumed it was ok. But I guess it is the source file which was causing the problem?
exactly, its been the source and a /recordings /Recordings) issue .. i must ve been blind.
and thanks alot for the upper information, helpful for the future
again sorry and thanks alot