DVD ISO
Here you can find different examples of actions you can do with your dvd_isos
Info
Returns the information of one DVD ISO.
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: infoDVDiso
# Language: Perl
#
# Description: this function returns DVD iso's information
###########################################################################
use strict;
use LWP::UserAgent;
use URI::Escape;
require Http::Request::Common;
#ID access to API
my $TOKEN = "{YOUR_API_TOKEN}"; # e.g.: "f03c3c76cc853ee690b879909c9c6f2a"
my $url = "https://api.cloudbuilder.es/v1";
sub _infoDVDIso
{
my ($id) = @_;
my $_command = $url ."/dvd_isos/$id";
my $_method = 'GET';
#Create the request
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new($_method => $_command);
$request->header('X-TOKEN' => $TOKEN);
$request->content_type('application/json');
#Get the response
my $response = $ua->request($request);
if($response)
{
#Get the response and close the handlers
print $response->headers()->as_string ."\n";
return $response->content;
$response->close;
$request->close;
}
else
{
#Get the error and close the handlers
return "Http Error Code: ", $response->code, "\n";
$request->close;
}
}
#Parameters
my $id = "{YOUR_ISO_ID}"; # e.g.: "5340033E7FBBC308BC329414A0DF3C20"
#Info isos
print _infoDVDIso($id);
<?php
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: infoDVDiso
# Language: PHP
#
# Description: this function returns DVD iso's information
###########################################################################
#ID access to API
$TOKEN = "{YOUR_API_TOKEN}"; # e.g.: "f03c3c76cc853ee690b879909c9c6f2a"
$url = "https://api.cloudbuilder.es/v1";
function infoDVDiso($id){
global $url;
global $TOKEN;
$_command = $url . "/dvd_isos/$id";
$request = curl_init();
//Set options
curl_setopt($request, CURLOPT_URL, $_command);
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($request, CURLOPT_HTTPHEADER, array("X-TOKEN:$TOKEN", "Content-Type:application/json"));
curl_setopt($request, CURLOPT_CUSTOMREQUEST, "GET");
//Try to get the response
$response = curl_exec($request);
if ($response == false){
return( curl_error($request));
}
else{
return( $response);
}
curl_close($request);
}
#PARAMETERS
$id = "{YOUR_ISO_ID}"; # e.g.: "5340033E7FBBC308BC329414A0DF3C20"
echo infoDVDiso($id);
?>
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: infoDVDiso
# Language: Python
#
# Description: this function returns DVD iso's information
###########################################################################
from urllib.request import Request, urlopen
import urllib
import json
#ID access to API
TOKEN = "{YOUR_API_TOKEN}" # e.g.: "f03c3c76cc853ee690b879909c9c6f2a"
url = "https://api.cloudbuilder.es/v1"
def _infoDVDiso():
#Configure the request
_command = url + "/dvd_isos/" + id
_method = 'GET'
request = Request(_command,
headers={'X-TOKEN':TOKEN, 'content-type':'application/json'},
method=_method)
#Try to get the response
try:
response = urlopen(request)
content = response.read()
return (content.decode())
#Fetch error
except urllib.error.URLError as e:
return("Error " + str(e.code) + ":" + e.reason)
#PARAMETERS
id = "{YOUR_ISO_ID}" # e.g.: "5340033E7FBBC308BC329414A0DF3C20"
#Info DVDs
print(_infoDVDiso())
List
Returns a list of all DVD ISOs.
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: listDVDisos
# Language: Perl
#
# Description: this function returns DVD isos
###########################################################################
use strict;
use LWP::UserAgent;
use URI::Escape;
require Http::Request::Common;
#ID access to API
my $TOKEN = "{YOUR_API_TOKEN}"; # e.g.: "f03c3c76cc853ee690b879909c9c6f2a"
my $url = "https://api.cloudbuilder.es/v1";
sub _listDVDIsos
{
my $_command = $url ."/dvd_isos";
my $_method = 'GET';
#Create the request
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new($_method => $_command);
$request->header('X-TOKEN' => $TOKEN);
$request->content_type('application/json');
#Get the response
my $response = $ua->request($request);
if($response)
{
#Get the response and close the handlers
print $response->headers()->as_string ."\n";
return $response->content;
$response->close;
$request->close;
}
else
{
#Get the error and close the handlers
return "Http Error Code: ", $response->code, "\n";
$request->close;
}
}
#List isos
print _listDVDIsos;
<?php
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: listDVDisos
# Language: PHP
#
# Description: this function returns DVD isos
###########################################################################
#ID access to API
$TOKEN = "{YOUR_API_TOKEN}"; # e.g.: "f03c3c76cc853ee690b879909c9c6f2a"
$url = "https://api.cloudbuilder.es/v1";
function listDVDisos(){
global $url;
global $TOKEN;
$_command = $url . "/dvd_isos";
$request = curl_init();
//Set options
curl_setopt($request, CURLOPT_URL, $_command);
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($request, CURLOPT_HTTPHEADER, array("X-TOKEN:$TOKEN", "Content-Type:application/json"));
curl_setopt($request, CURLOPT_CUSTOMREQUEST, "GET");
//Try to get the response
$response = curl_exec($request);
if ($response == false){
return( curl_error($request));
}
else{
return( $response);
}
curl_close($request);
}
#PARAMETERS
echo listDVDisos();
?>
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: listDVDisos
# Language: Python
#
# Description: this function returns DVD isos
###########################################################################
from urllib.request import Request, urlopen
import urllib
import json
#ID access to API
TOKEN = "{YOUR_API_TOKEN}" # e.g.: "f03c3c76cc853ee690b879909c9c6f2a"
url = "https://api.cloudbuilder.es/v1"
def _listDVDisos():
#Configure the request
_command = url + "/dvd_isos"
_method = 'GET'
request = Request(_command,
headers={'X-TOKEN':TOKEN, 'content-type':'application/json'},
method=_method)
#Try to get the response
try:
response = urlopen(request)
content = response.read()
return (content.decode())
#Fetch error
except urllib.error.URLError as e:
return("Error " + str(e.code) + ":" + e.reason)
#PARAMETERS
#List DVDs
print(_listDVDisos())