Project

General

Profile

API

Added by Charles Johnson over 3 years ago

I'm trying to add an arbitrary .ts file so it will appear in the recordings list and I found a script, the 'active ingredient' of which is:

curl -q --data @/tmp/import.json "http://username:passwd@$TVH_HOST:9981/api/dvr/entry/create" 

I'm assuming i don't need any extra API download for that. This is what i get in return (again i'm assuming that the path i'm giving is the one to where the file on the tvh server actually is [so i kludged it]):

goose@t410:/tmp$ ./tvimport h/tmp/Surveillance.ts 
Sending create command for "tmp" 
<!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>

TIA


Replies (6)

RE: API - Added by Charles Johnson over 3 years ago

No i wasn't, but thanks. Though it doesn't get me out of my current http problem

RE: API - Added by Lloyd Adams over 3 years ago

It reads to me like that API is for adding a timer entry. Be interesting to see if it can be used for adding an arbitrary file - that's something I've often pondered doing.

RE: API - Added by Lloyd Adams over 3 years ago

sorry, just read the page myself. Most interesting.

RE: API - Added by Lloyd Adams over 3 years ago

What are you passing in the json?

RE: API - Added by Charles Johnson over 3 years ago

conf={
    "enabled": true,
    "start": 1614019173,
    "stop":  1614019392,
    "channelname": "local file",
    "title": {
        "eng": "hts" 
    },
    "subtitle": {
        "eng": "filename: Surveillance.ts" 
    },
    "description": {
        "eng": "" 
    },
    "comment": "added by /usr/local/bin/tvimport",
    "files": [
        {
            "filename": /home/hts/Surveillance.ts
        }
    ]
}


Thanks so much for your help. I needed to ensure that "filename" had a double-quoted value. ALl working now
    (1-6/6)