LogoLogo
ForumCodeDonate
  • Introduction
    • About
    • Release / Change Log
  • Installation
    • Requirements
    • Tuners
    • Linux
    • Virtualisation - Proxmox
    • Docker
    • NAS
    • Android
  • SETUP
    • Stages
    • Concepts
    • Muxes/Scan Files
      • Scan Files
      • Using w_scan Scan Files
  • CONFIGURATION
    • Concepts
    • Electronic Program Guide
    • Digital Video Recorder
    • Web User Interface Customisation
      • Theme
      • Date/Time Format
  • HTTPS access via Reverse Proxy
  • APPENDICES
    • FAQ
    • CLI Commands
    • Debugging
  • Development
    • Compiling
      • Compiling TVH with VAAPI Support
        • for Lubuntu 24.04
        • for Lubuntu 22.04
        • Level 2
    • HTSP
      • General
      • HTSMSG Binary Format
      • Communication
      • Client to Server (RPC) methods
      • Server to Client methods
      • Protocol Changes
      • HTTP Proxy Examples
    • JSON API
      • API Description
        • Common Parameters
        • Access
        • Bouquet
        • Caclient
        • Channel
        • Codec
        • Config
        • DVR
        • EPG
        • EPGgrab
        • ESfilter
        • idnode
        • Input
        • intlconv/charsets
        • Language
        • MPEGts
        • Profile
        • RatingLabel
        • Raw
        • Satip
        • Service
        • Status
        • Timeshift
        • Tvhlog
      • Examples
      • Other Functions
      • WebSocket
    • Object Class Relationships
    • Testing Tuners Using Files
    • Translations
    • Programmers Translation Workflow
    • XMLTV
      • Input
        • Recognised Tags/Attributes
        • Episode Numbering
      • Output
    • Object ID Representation
    • WebUI Help Content Workflow
    • Random Notes
  • Creating a Mux Dump
  • WIP
    • Release / Change Log Mockup
Powered by GitBook

© Tvheadend 2006-2024

On this page
  • HTSP API Syntax Summary
  • Simple Request
  • Intermediate Request
  • Advanced Request

Was this helpful?

Export as PDF
  1. Development
  2. HTSP

HTTP Proxy Examples

PreviousProtocol ChangesNextJSON API

Last updated 1 year ago

Was this helpful?

The HTSP api method can be used as a proxy to access the HTTP/JSON API. This allows HTSP-only clients access to any JSON feature, including JSON-only features. Data exchanged to and from the TVH server is achieved by encapsulating the required HTTP/JSON parameters within the HTSP message. TVH expects to receive encapsulated JSON data and will respond with a HTSP map representing the JSON data returned.

Also see: .

HTSP API Syntax Summary

Request:

args               msg[] optional   HTTP arguments
path               str   required   HTTP path

Reply:

response           msg[] required   JSON response 

Simple Request

To execute the HTTP API command: http://TVH:9981/api/channel/grid Set the path field to channel/grid and send the request. The args field is not required. The response will be a HTSP map containing an element named response. This element will be a map containing the the JSON response presented as HTSP elements.

Intermediate Request

To execute the HTTP API command: http://TVH:9981/api/channel/grid?sort=number&dir=desc Set the path to channel/grid as in the previous example. The arg field must be set to type map, and in this example, contain two str elements. Map str element named sort should contain the value number and map str element named dir should contain the value desc.

Advanced Request

To execute the HTTP API command: http://TVH:9981/api/dvr/entry/create Set the path to dvr/entry/create. As with the previous example, the args field must be set to type map. Method 1 - JSON String Create a JSON string containing the properties required to complete the request as detailed in the . In this example, to create a new DVR entry. Within that map, create a str element named conf that contains the required JSON string. Method 2 - HTSP Map Instead of creating a JSON string, create a HTSP map where each element name matches the name of the JSON property and contains the required property value. args should be a map that contains another map named conf that contains another map with the required JSON data represented as HTSP elements.

JSON API
JSON API documentation