Info

Returns the information of one Server Appliance.

###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: infoServerAppliance
# Language: Perl
#
# Description: this function returns information about server appliance
###########################################################################
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 _infoServerAppliance
{	
	my ($id) = @_;
	my $_command = $url ."/server_appliances/$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_APPLIANCE_ID}"; # e.g.: "5340033E7FBBC308BC329414A0DF3C20"

#Info server appliance
print _infoServerAppliance($id);
<?php
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: infoServerAppliance
# Language: PHP
#
# Description: this function returns information about server appliance
###########################################################################

#ID access to API
$TOKEN = "{YOUR_API_TOKEN}"; # e.g.: "f03c3c76cc853ee690b879909c9c6f2a"
$url = "https://api.cloudbuilder.es/v1";

function infoServerAppliance($id){
	global $url;
	global $TOKEN;
	$_command = $url . "/server_appliances/$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_APPLIANCE_ID}"; # e.g.: "5340033E7FBBC308BC329414A0DF3C20"

echo infoServerAppliance($id);
?>
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: infoServerAppliance
# Language: Python
#
# Description: this function returns information about server appliance
###########################################################################
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 _infoServerAppliance(id):
    #Configure the request
    _command = url + "/server_appliances/" + 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_APPLIANCE_ID}" # e.g.: "5340033E7FBBC308BC329414A0DF3C20"

#Info server appliance
print(_infoServerAppliance(id))

List

Returns a list of all Server Appliances.

###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: listServerAppliances
# Language: Perl
#
# Description: this function returns server appliances
###########################################################################
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 _listServerAppliances
{	
	my $_command = $url ."/server_appliances";
	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 server appliances
print _listServerAppliances;
<?php
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: listServerAppliances
# Language: PHP
#
# Description: this function returns server appliances
###########################################################################

#ID access to API
$TOKEN = "{YOUR_API_TOKEN}"; # e.g.: "f03c3c76cc853ee690b879909c9c6f2a"
$url = "https://api.cloudbuilder.es/v1";

function listServerAppliances(){
	global $url;
	global $TOKEN;
	$_command = $url . "/server_appliances";
	$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 listServerAppliances();
?>
###########################################################################
# CLOUD SERVER API DOCUMENTATION
#
# Name: listServerAppliances
# Language: Python
#
# Description: this function returns server appliances
###########################################################################
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 _listServerAppliances():
    #Configure the request
    _command = url + "/server_appliances"
    _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 server appliances
print(_listServerAppliances())