- Overview
- License
- Architecture
- System
- Performance
- Install
- Upgrade
- Uninstall
- Release Note
- Web Panel
- Config File
- Process
- Startup
- Shutdown
- Port
- Troubleshooting
- RTMP Push
- SRT Push
- SRT Pull
- UDP Push
- UDP Broadcast
- Source Stream
- Pull Stream
- Playback
- Forward
- SSL
- Snapshot
- UDP packet
- Record & NVR
- VOD
- GB28181
- WebRTC
- API
- Compare to Wowza
Ti Top Streamer can provide Http Rest API to external system.
These APIs will meet the business needs of various industry solutions. If these APIs do not meet your needs, please contact us by email or phone.
1. some basic principles:
1)support HTTP protocol, HTTPS protocol not currently supported
2)All characters in the URL are case sensitive
3)Both request and response data are in Json format
4)Parameter names in Json body should be case sensitive
5)When the HTTP status code is 200, it indicates that the API call operation was successful, otherwise it is considered a failure. There are various status codes depending on the reason for the failure. So you can judge success or failure based on the status code
6)The Json message in all API responses contains a "code" parameter, which is equivalent to the HTTP status code.
7)If the response data is an array, it will be wrapped in the "list" parameter, for example, {"code":200,"list":[]}
8)If the response data is an object, it will be wrapped in the "data" parameter,for example,{"code":200,"data":{}}
9)If the operation called by the API fails, an error "message" will be wrapped in the message, for example,{"code":500,"message":"add application failed,internal error"}
2. API detailed description:
According to feature relevance, we categorize the Http Rest API of Ti Top Streamer into the following 5 categories:
1. create a new app
http url | /v1/app |
http method | POST |
request body | {"app_name":"live","source_type":"rtmp_push"} |
response http status code and response body |
200: success, body: {"code":200,"message":"add application success"} 400: Failed, lack app_name or source_type parameter, Or unsupported source types. body: {code:400,message:"the parameter app_name is needed"} 409: Failed, duplicated app_name. body: {"code":409,"message":"duplicated application name"} 500: Failed, unknown internal reason. body: {"code":500,"message":"add application failed,internal error"} 500: Failed, network exception. body: {"code":500,"message":"network exception"} |
Notes:
1)app_name is the name of app, It's a string with a length ranging from 2 to 40. The valid chars including A-Z,a-z,0-9,"-" and "_". A name that is too long is not easy to display on the management web UI, so it is recommended that you use a length of 4-10, e.g: live.
2)source_type present source type of a live stream, At present,We already support belows protocol : rtmp_push,rtmp_pull,mpegts_over_udp,srt_listener,gb28181,webrtc. This parameter is not case sensitive. As the version continues to iterate, other source types will be added in the future.
2. Delete an Application
http url | /v1/apps/[app_name] |
http method | DELETE |
request body | None |
response http status code and response body |
200: success, body: {"code":200,"message":"delete application success"} 404: Failed, the application referred is not exist. body: {"code":404,"message":"the application referred is not exist"} 500: Failed, unknown internal reason. body: {"code":500,"message":"delete application failed,internal error"} 500: Failed, network exception. body: {"code":500,"message":"network exception"} |
3. Get APP list
http url | /v1/apps |
http method | GET |
query parameter | None |
response http status code and response body |
200: success, body: {"code":200,"list":[{"name":"live","source_type":"rtmp_push","created":"20220226152411"},{"name":"live2","source_type":"rtmp_pull","created":"20220226152411"}] 500: Failed, unknown internal reason. body: {"code":500,"message":"get application list failed,internal error"} 500: Failed, network exception. body: {"code":500,"message":"network exception"} |
4. get the input settings related to in an APP
http url | /v1/apps/[app_name]/input/setting |
http method | GET |
query parameter | None |
response http status code and response body |
200: success, body: {"code":200,"data":{}} 404: Failed, body: {"code":404,"message":"the application referred is not exist"} 500: Failed, unknown internal reason. body: {"code":500,"message":"get input setting failed"} 500: Failed, network exception. body: {"code":500,"message":"network exception"} |
Notes: Different types of apps have different behaviors in the video stream input process, so they also have different configuration parameters.
For example:
For the APP with source type "RTMP_PUSH" , the data parameter in above API:
{"gop":false,"security":{"white_ip_list":"","black_ip_list":"","token_protect":true,"shared_key":"","duplicate":"replace"}}
For the APP with source type "RTMP_PULL" , the data parameter in above API:
{"static":true,"gop":false,"connection":{"connect_timeout":6000,"reconnect_interval":10000,"connect_double_interval":false,"max_interval":300000,"stream_timeout":3000}}
5. Set input parameter for the APP
http url | /v1/apps/[app_name]/input/setting |
http method | POST |
request body |
{"gop":true,"stream_timeout":4000,"token_protect":false,"shared_key":"","callback_url":"","white_ip_List":"","black_ip_list":"","duplicate":"replace"}
or {"gop":true,"static":true,"bind_local_ip":"","connect_timeout":6000,"stream_timeout":3000,"reconnect_interval":10000,"is_double":false} |
response http status code and response body |
200: success, body: {"code":200,"message":"save input setting success"} 404: Failed, body: {"code":404,"message":"the application referred is not exist"} 500: Failed, unknown internal reason. body: {"code":500,"message":"save input setting failed"} 500: Failed, network exception. body: {"code":500,"message":"network exception"} |
Notes: Different types of apps have different behaviors in the video stream input process, so they also have different configuration parameters.
6. Get the output parameter for an APP
http url | /v1/apps/[app_name]/playback/setting |
http method | GET |
query parameter | None |
response http status code and response body |
200: success, body: {"code":200,"data":{"hls":{"enable":true,"max_segment_duration":4000,"max_segment_count":3,"min_segment_count":1},"rtmp":{"enable":true},"flv":{"enable":true},"rtsp":{"enable":true},"http":{"cross_domain":true},"security":{"white_ip_list":"","black_ip_list":"","token_protect":false,"shared_key":"","callback_url":""}}} 404: Failed, body: {"code":404,"message":"the application referred is not exist"} 500: Failed, unknown internal reason. body: {"code":500,"message":"get playback setting failed"} 500: Failed, network exception. body: {code:500,message:"network exception"} |
7. Set the output parameter for an APP
http url | /v1/apps/[app_name]/playback/setting |
http method | POST |
request body | {"protocol_hls":true,"protocol_flv":true,"protocol_rtmp":true,"protocol_rtsp":true,"token_protect":false,"shared_key":"", "white_ip_list":"","black_ip_list":"","callback_url":"","cross_domain":true,"segment_duration":4000} |
response http status code and response body |
200: success, body: {"code":200,"message":"save playback setting success"} 404: Failed, body: {"code":404,"message":"the application referred is not exist"} 500: Failed, unknown internal reason. body: {"code":500,"message":"save playback setting failed"} 500: Failed, network exception. body: {"code":500,"message":"network exception"} |
8. Get concurrent stream statistic data for an APP
http url | /v1/apps/[app_name]/status |
http method | GET |
query parameter | None |
response http status code and response body |
200: success, body: {code:200,data:{streams:{},playbacks:{},forwards:{}}} 404: Failed, body: {code:404,message:"the application referred is not exist"} 500: Failed, unknown internal reason. body: {"code":500,"message":"get statistic failed"} 500: Failed, network exception. body: {code:500,message:"network exception"} |
Note: The parameter "data" in the response data include three concurrent stream statistic data: 1)concurrent of input streams. 2) concurrent of playback streams. 3)concurrent of forward streams.
9. Get internal running events within a certain historical time range of an APP
http url | /v1/apps/[app_name]/event |
http method | GET |
query parameter | supported query parameter include category,stream_name,sid,date,start_time,end_time, for example ?category=PUBLISH&stream_name=myStream&sid=rtmp_2930&date=20210211&start_time=09:10&end_time=12:45 |
response http status code and response body |
200: success, body: {"code":200,"list":[]} 404: Failed, body: {"code":404,"message":"the application referred is not exist"} 500: Failed, unknown internal reason. body: {"code":500,"message":"query application event failed"} 500: Failed, network exception. body: {"code":500,"message":"network exception"} |
Note: In the above query parameters:
1)category: Representing a workflow(or process), such as live stream input, live stream playback, and live stream forward, it is an enumeration value, and legal values include:PUBLISH,SOURCE,PLAYBACK,FORWARD,TCP,UDP
2)stream_name: Representing a stream ID
3)sid : Representing sessionId(When you don't know what session ID is, you can ignore this query parameter. Based on the query results, you can see the sessionId, so that you can further query through sid).
4)date : Representing date, format is "YYYYMMDD"
5)start_time : Representing start time,format is hh:mm, The parameter value is accurate to the minute, but in reality, it is accurate to 0 seconds of this minute
6)end_time : Representing end time, format is hh:mm, The parameter value is accurate to the minute, but in reality, it is accurate to 59 seconds of this minute