Over 10 years we helping companies reach their financial and branding goals. Onum is a values-driven SEO agency dedicated.

LATEST NEWS
CONTACTS
New

All api of xtream ui and xtream code

Xtream UI Panel 12

API of xtream ui

  • View Server List
    Perform this request, to view all your servers, main & load balancers including their statushttp://your_dns:port/api.php?action=server&sub=list

    Code:
    ex: curl "http://127.0.0.1:80/api.php?action=server&sub=list"
  • View Online Streams
    Perform this request, to view only the online Live Streamshttp://your_dns:port/api.php?action=stream&sub=online

    Code:
    ex: curl "http://127.0.0.1:80/api.php?action=stream&sub=online"
  • View Offline Streams
    Perform this request, to view only the Offline Live Streamshttp://your_dns:port/api.php?action=server&sub=offline

    Code:
    ex: curl "http://127.0.0.1:80/api.php?action=server&sub=offline"
  • Start/Restart A Stream
    Perform this request, to start or restart a Live Stream. The last argument is an array in which you can specify the stream ids. It works with POST method as well.http://your_dns:port/api.php?action=stream&sub=start&stream_ids[]=1
  • Code:
    ex: curl "http://127.0.0.1:80/api.php?action=stream&sub=start&stream_ids[]=51"
  • Stop A Stream
    Perform this request, to stop a Live Stream. The last argument is an array in which you can specify the stream ids. It works with POST method as well.http://your_dns:port/api.php?action=stream&sub=stop&stream_ids[]=1

    Code:
    ex: curl "http://127.0.0.1:80/pi.php?action=stream&sub=stop&stream_ids[]=557"
  • Start VOD Encoding (Applies for series episodes as well )
  • Perform this request, to start a VOD Encoding process. The last argument is an array in which you can specify the stream ids. It works with POST method as well.http://your_dns:port/api.php?action=vod&sub=start&stream_ids[]=1
    Code:
    ex: curl "http://127.0.0.1:80/api.php?action=vod&sub=start&stream_ids[]=554"
  • Stop A VOD Encoding
    Perform this request, to stop a VOD Encoding. The last argument is an array in which you can specify the stream ids. It works with POST method as well.http://your_dns:port/api.php?action=vod=stop&stream_ids[]=1

API of xtream code

Authentication
player_api.php?username=X&password=X
GET Live Stream Categories
player_api.php?username=X&password=X&action=get_live_categories
GET VOD Stream Categories
player_api.php?username=X&password=X&action=get_vod_categories
GET SERIES Categories
player_api.php?username=X&password=X&action=get_series_categories
GET LIVE Streams
player_api.php?username=X&password=X&action=get_live_streams (This will get All LIVE Streams)
player_api.php?username=X&password=X&action=get_live_streams&category_id=X (This will get All LIVE Streams in the selected category ONLY)
GET VOD Streams
player_api.php?username=X&password=X&action=get_vod_streams (This will get All VOD Streams)
player_api.php?username=X&password=X&action=get_vod_streams&category_id=X (This will get All VOD Streams in the selected category ONLY)
GET SERIES Streams
player_api.php?username=X&password=X&action=get_series (This will get All Series)
player_api.php?username=X&password=X&action=get_series&category_id=X (This will get All Series in the selected category ONLY)
GET SERIES Info
player_api.php?username=X&password=X&action=get_series_info&series_id=X
GET VOD Info
player_api.php?username=X&password=X&action=get_vod_info&vod_id=X (This will get info such as video codecs, duration, description, directors for 1 VOD)

GET short_epg for LIVE Streams (same as stalker portal, prints the next X EPG that will play soon)
player_api.php?username=X&password=X&action=get_short_epg&stream_id=X
player_api.php?username=X&password=X&action=get_short_epg&stream_id=X&limit=X (You can specify a limit too, without limit the default is 4 epg listings)
GET ALL EPG for LIVE Streams (same as stalker portal, but it will print all epg listings regardless of the day)
player_api.php?username=X&password=X&action=get_simple_data_table&stream_id=X
Full EPG List for all Streams
xmltv.php?username=X&password=X

Xtream api

Creating New Line

To create a Newline, we will call the following URL.

http://dns:port/api.php?action=user&sub=create The above URL, accepts the POST action, and to create a new line we will have to specify some arguments in an array called user_data

Example Code:

ex: curl "array( 'username' => $username, 'password' => $password, 'max_connections' => $max_connections, 'is_restreamer' => $reseller, 'exp_date' => $expire_date, 'bouquet' => json_encode( $bouquet_ids ) ) ); $opts = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query( $post_data ) ) ); $context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . "api.php?action=user&sub=create", false, $context ) ); ?>"

If you leave the username and/or password elements empty, the system will generate random characters for these 2 fields. In addition, leaving any field empty, API will use the default value for this field according to SQL Database. So theoretically, you can make a line with just Calling the Above URL, without any parameter, however, the created user, won’t have any bouquets inside.

You can call any other element that is in the database like

member_id admin_enabled enabled allowed_ips allowed_ua force_server_id is_isplock admin_notes and so on… If you want to set the allowed_ips/allowed_ua since this is a JSON Encoded format you can do it like a bouquet in the above Code.

The API will return a simple json encoded string that upon decoding will contain the element result which returns true/false.

Example (API Success)

ex: curl "{"result":true,"created_id":14838,"username":"d4PSc5uCqF","password":"2ZiuRRZk4b"}"

The API returned as the username/password of the NEW line, as well as the ID so we can use it wherever we want.
Example(API Failed)

ex: curl "{"result":false,"error":"EXISTS"} {"result":false,"error":"PARAMETER ERROR"}"

EXISTS The Username you specified already exists in the database PARAMETER ERROR You wrote invalid characters in your user_data array Editing Line
To procedure to edit a line is very similar to the above. The URL we will call this time is
http://dns:port/api.php?action=user&sub=edit REQUIRED PARAMETERS

username password OPTIONAL PARAMETERS
user_data array For example if we want to Edit the Expire Date, make the line streamer and adjusting the max connections to 10 we will do it like this:
$username, ‘password’ => $password, ‘user_data’ => array( ‘max_connections’ => $max_connections, ‘is_restreamer’ => $reseller, ‘exp_date’ => $expire_date ) ); $opts = array( ‘http’ => array( ‘method’ => ‘POST’, ‘header’ => ‘Content-type: application/x-www-form-urlencoded’, ‘content’ => http_build_query( $post_data ) ) ); $context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . “api.php?action=user&sub=edit”, false, $context ) ); ?>
In the above example, we will edit the max_connections, is_restreamer and exp_date for our line with username test_username, and password test_password that already exists in our database.
Example(API Success)

ex: curl "{"result":true}"

Example(API Failed)

ex: curl "{"result":false,"error":"NOT EXISTS"} {"result":false,"error":"PARAMETER ERROR"}"
ex: curl "{"result":false,"error":"PARAMETER ERROR (user/pass)"}"

NOT EXISTS The Username / Password you specified are not exist in the database PARAMETER ERROR You wrote invalid characters in your user_data array PARAMETER ERROR (user/pass) The Username OR/AND Password elements are missing

View Line Information

With this API call, we will get all the information available about our line including the active connections.

The URL we will call this time is

http://dns:port/api.php?action=user&sub=info REQUIRED PARAMETERS

username password It will return a JSON Encoded string, with all information that you might want.
Example Code:

ex: curl "$panel_url = 'http://DNS:PORT/'; $username = "username"; $password = "passwrd";

############################################################################### $post_data = array( 'username' => $username, 'password' => $password ); $opts = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query( $post_data ) ) );

$context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . "api.php?action=user&sub=info", false, $context ), true );

if ( $api_result['result'] ) { echo "Active Connections (Now): " . $api_result['user_info']['active_cons']; echo "\nCurrent Expire Date: " . (( empty( $api_result['user_info']['exp_date'] ) ) ? 'Unlimited' : strtotime( $api_result['user_info']['exp_date'] )); echo "\nMax Connections: " . $api_result['user_info']['max_connections']; echo "\nAvailable Channel IDs: " . implode( ',', $api_result['user_info']['channel_ids'] ); } else echo 'FAILED';"

Create/Edit & View Information on MAG Devices

The procedure is almost the same as creating/editing & view info on a user line. The only difference is that instead of calling the user action, we will the stb action. Of course instead of username/password we will just have the mac parameter.

Example API Call To Create New MAG

http://dns:port/api.php?action=stb&sub=create REQUIRED PARAMETERS

user_data[mac]

ex: curl "array( 'mac' => $mac, 'exp_date' => $expire_date, 'bouquet' => json_encode( $bouquet_ids ) ) ); $opts = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query( $post_data ) ) ); $context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . "api.php?action=stb&sub=create", false, $context ) ); print_r($api_result); ?>"

Example(API Success)

ex: curl "{"result":true}"

Example(API Failed)

ex: curl "{"result":false,"error":"NOT EXISTS"} {"result":false,"error":"PARAMETER ERROR"} {"result":false,"error":"PARAMETER ERROR (mac)"}"

EXISTS The MAC already exists in the database PARAMETER ERROR You wrote invalid characters in your user_data array PARAMETER ERROR (mac) The MAC Parameter was missing

Example API Call To Edit a MAG Device

http://dns:port/api.php?action=stb&sub=edit REQUIRED PARAMETERS

mac

ex: curl "$mac, 'user_data' => array( 'exp_date' => $expire_date, 'bouquet' => json_encode( $bouquet_ids ) ) ); $opts = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query( $post_data ) ) ); $context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . "api.php?action=stb&sub=edit", false, $context ) ); ?>"

Example(API Success)

ex: curl "{"result":true}"

Example(API Failed)

ex: curl "{"result":false} {"result":false,"error":"PARAMETER ERROR"} {"result":false,"error":"PARAMETER ERROR (mac)"}"

no error The updated information is the same as in the database, so no action was taken. PARAMETER ERROR You wrote invalid characters in your user_data array PARAMETER ERROR (mac) The MAC Parameter was missing

View Information MAG Device

http://dns:port/api.php?action=stb&sub=info REQUIRED PARAMETERS

mac It will return a JSON Encoded string, with all information that you might want.

Example Code:

ex: curl "$mac); $opts = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query( $post_data ) ) ); $context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . "api.php?action=stb&sub=info", false, $context ), true ); if ( $api_result['result'] ) { echo "Active Connections (Now): " . $api_result['user_info']['active_cons']; echo "\nCurrent Expire Date: " . ( ( empty( $api_result['user_info']['exp_date'] ) ) ? 'Unlimited' : strtotime( $api_result['user_info']['exp_date'] ) ); echo "\nMax Connections: " . $api_result['user_info']['max_connections']; echo "\nAvailable Channel IDs: " . implode( ',', $api_result['user_info']['channel_ids'] ); } else echo 'FAILED'; ?>"

Like 1 Spyer reacted to this Quote BlackDream Registered Loser BlackDream Administrators 156 192 posts Report post Posted January 5, 2017 API has been updated and few bugs regarding bouquet handling are now fixed.

Also, here are few other requests you can make to the API

View Server List Perform this request, to view all your servers, main & load balancers including their status

http://your_dns:port/api.php?action=server&sub=list

View Online Streams Perform this request, to view only the online Live Streams

http://your_dns:port/api.php?action=stream&sub=online

View Offline Streams Perform this request, to view only the Offline Live Streams

http://your_dns:port/api.php?action=server&sub=offline

Start/Restart A Stream Perform this request, to start or restart a Live Stream. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

http://your_dns:port/api.php?action=stream&sub=start&stream_ids[]=1

Stop A Stream Perform this request, to stop a Live Stream. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

Like 1 Spyer reacted to this Quote BlackDream Registered Loser BlackDream Administrators 156 192 posts Report post Posted January 5, 2017 API has been updated and few bugs regarding bouquet handling are now fixed.

Also, here are few other requests you can make to the API

View Server List Perform this request, to view all your servers, main & load balancers including their status

http://your_dns:port/api.php?action=server&sub=list

View Online Streams Perform this request, to view only the online Live Streams

http://your_dns:port/api.php?action=stream&sub=online

View Offline Streams Perform this request, to view only the Offline Live Streams

http://your_dns:port/api.php?action=server&sub=offline

Start/Restart A Stream Perform this request, to start or restart a Live Stream. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

http://your_dns:port/api.php?action=stream&sub=start&stream_ids[]=1

Stop A Stream Perform this request, to stop a Live Stream. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

http://your_dns:port/api.php?action=streamsub=stop&stream_ids[]=1

Start VOD Encoding (Applies for series episodes as well ) Perform this request, to start a VOD Encoding process. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

http://your_dns:port/api.php?action=vod&sub=start&stream_ids[]=1

Stop A VOD Encoding Perform this request, to stop a VOD Encoding. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

http://your_dns:port/api.php?action=vod=stop&stream_ids[]=1

Start VOD Encoding (Applies for series episodes as well ) Perform this request, to start a VOD Encoding process. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

http://your_dns:port/api.php?action=vod&sub=start&stream_ids[]=1

Stop A VOD Encoding Perform this request, to stop a VOD Encoding. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

http://your_dns:port/api.php?action=vod=stop&stream_ids[]=1

Author

admin

Leave a comment

Your email address will not be published. Required fields are marked *