docs for api
Added by James Brown almost 6 years ago
being new to tvheadend i wanted to learn more about the api. i read in 4.2 changelog "whole HTTP data interface is accessible through /api URLs". where can i find documentation for the api
Replies (16)
RE: docs for api - Added by Paul M almost 6 years ago
I've found the API to be very good, I've been using the dave-p github docs for it. However, they'll be a little out of date now. Does anyone know if they'll be updated any time soon?
I've been using that API guide to write a simple EPG (https://github.com/speculatrix/tvh_epg) and I am hoping to find out how to get a URL which includes an authentication token, because at the moment clicking on a channel and opening the .m3u in VLC requires entering a password into VLC.
RE: docs for api - Added by Dave Pickles almost 6 years ago
I try to keep the API docs up-to-date with TVH master, however I haven't tried to use the new authentication token functions. If you have a working example I can add it to the docs.
RE: docs for api - Added by Paul M almost 6 years ago
Hi,
'fraid I don't know anything about the "authentication token functions" of which you speak, hence asking here!
RE: docs for api - Added by Paul M over 5 years ago
Apparently there's something called "persistent authentication". I don't know if it applies to the JSON API. There's nothing in the tvh wiki about it. A few bug reports vaguely discuss it. It seems that there's a way to have TVH reply to query with the URL containing a temporary auth token which allows the stream to be started without needing to go through additional authentication.
RE: docs for api - Added by Dave Pickles over 5 years ago
It's intended for client devices which can't provide authentication by username and password.
The TVH UI has a ticket-issuing machine under Configuration -> Users -> Passwords. The authentication ticket can then be (manually) appended to the stream URL entered into the client. The client will then return the ticket as part of the URL when requesting to view a stream. The help screen for Configuration -> Users -> Passwords gives some examples.
At least that's my understanding; I've never tried it.
RE: docs for api - Added by saen acro over 5 years ago
http://USERNAME:[email protected]:9981/playlist/auth/channels
playlist taken this way, do not require any more authentication
RE: docs for api - Added by Paul M over 5 years ago
thanks, Dave P. Is it possible using the APi to get one of those tokens. I poked through https://github.com/dave-p/TVH-API-docs/wiki/Access and didn't see anything.
RE: docs for api - Added by Paul M over 5 years ago
I managed to find the source to the bit of the api which deals with access:
https://tvheadend.org/projects/tvheadend/repository/revisions/master/entry/src/api/api_access.c
and there's no mention of being able to get a persistent auth token, or get one created, so I guess I need to hope someone will write that feature!?
RE: docs for api - Added by Dave Pickles over 5 years ago
I believe that it can be done, though the UI is rather easier...
You would normally need to create a new TVH user record for your client device, which can be done using api/access/entry/create. Then create a password record using api/passwd/entry/create, including the 'authcode' as in the snippet below:
{ "uuid": "2f2ef17dec370a5ee4f46443095cc898", "enabled": true, "username": "test", "auth": [ "enable" ], "authcode": "PVbj4aCNGDCSOLcyEpKaJK2W8PdQ", "wizard": false }
I believe the authcode is simply base64-coded random noise.
However I'm having problems getting the token feature to work reliably so I may have overlooked something.
RE: docs for api - Added by Paul M over 5 years ago
I added manual use of "persistent auth" token to my tvh_epg program, rather than getting it programmatically
get it at your favourite repository, https://github.com/speculatrix/tvh_epg
RE: docs for api - Added by Georger Geo over 5 years ago
http://USERNAME:[email protected]:9981/playlist/auth/channels << In this link, how can I avoid "USERNAME:PASSWORD@" section? I need only to take "Your.TVH.IP.or.DNS.name:9981/playlist/auth/channels " excluding "USERNAME:PASSWORD@", at the same time no need to use " 5 minute ticket", is that possible?
RE: docs for api - Added by saen acro over 5 years ago
Georger Geo wrote:
http://USERNAME:[email protected]:9981/playlist/auth/channels << In this link, how can I avoid "USERNAME:PASSWORD@" section? I need only to take "Your.TVH.IP.or.DNS.name:9981/playlist/auth/channels " excluding "USERNAME:PASSWORD@", at the same time no need to use " 5 minute ticket", is that possible?
This link is to get playlist once in time.
Playlist stored elsewhere, do not need password anymore.
Password is needed only on playlist request from server
p.s.
persistent auth != token
there is no limits via IP address, client identification etc.
RE: docs for api - Added by Georger Geo over 5 years ago
Hi
I enabled persistent auth, on admin account, saved.
then entered http://admin:admin@1**.1**.198.3*:9981/playlist/auth/channels , and result is:
400 Bad Request¶
current tvh version: HTS Tvheadend 4.2.8-17~gd64d8c808
RE: docs for api - Added by saen acro over 5 years ago
Georger Geo wrote:
Hi
I enabled persistent auth, on admin account, saved.
then entered http://admin:admin@1**.1**.198.3*:9981/playlist/auth/channels , and result is:
400 Bad Request¶
current tvh version: HTS Tvheadend 4.2.8-17~gd64d8c808
4.2.x not supported