API Documentation/en
Aus EUserv Wiki
Root (Diskussion | Beiträge) (→CALL PARAMETERS) |
Root (Diskussion | Beiträge) |
||
Zeile 1.783: | Zeile 1.783: | ||
?> | ?> | ||
</nowiki> | </nowiki> | ||
+ | |||
+ | === server.get_traffic_graph === | ||
+ | ==== PURPOSE ==== | ||
+ | This method is used to get a traffic-graph for your server. | ||
+ | |||
+ | ==== CALL PARAMETERS ==== | ||
+ | {|width="100%" cellspacing="0" border="2px solid" | ||
+ | |- | ||
+ | |'''Field / Key Name''' ||'''Type''' || '''Description''' | ||
+ | |- | ||
+ | |srv_id||int||The id of the server for which you want to get a traffic-graph. | ||
+ | |- | ||
+ | |graph_mode(optional)||int||The mode of the graph you want to get (0 = LAST DAY, 1 = LAST WEEK,2 = LAST MONTH,3 = LAST YEAR). | ||
+ | |- | ||
+ | |graph_language(optional)||string||The language of the graph you want to get (ISO Country Code, lower case). Possible types are 'en', 'de'. Default is 'en'. | ||
+ | |} | ||
+ | |||
+ | ====RETURNS==== | ||
+ | {|width="100%" cellspacing="0" border="2px solid" | ||
+ | |- | ||
+ | |'''Field / Key Name''' ||'''Type''' || '''Description''' | ||
+ | |- | ||
+ | |traffic_graph||string||The base64 encoded data of the graph you want to get. | ||
+ | |} | ||
+ | |||
+ | ==== METHOD ERRORS ==== | ||
+ | {|width="100%" cellspacing="0" border="2px solid" | ||
+ | |- | ||
+ | |'''Code''' ||'''Short Message''' || '''Description''' | ||
+ | |- | ||
+ | |1001||srv_id not given||The srv_id was not given. | ||
+ | |- | ||
+ | |1002||srv_graph_mode not valid||The given srv_graph_mode is not valid. | ||
+ | |- | ||
+ | |1003||can not load portdata||Cannot load portdata, please contact the support! | ||
+ | |- | ||
+ | |1004||can not load portdata||Cannot load portdata, please contact the support! | ||
+ | |- | ||
+ | |1005||can not load portdata||Cannot load portdata, please contact the support! | ||
+ | |} | ||
+ | |||
+ | ==== PHP EXAMPLE ==== | ||
+ | <nowiki> | ||
+ | <?php | ||
+ | //includes the class library | ||
+ | include_once("lib/xmlrpc.inc"); | ||
+ | $xmlrpc_internalencoding = 'UTF-8'; | ||
+ | $host="api.test.euserv.net"; | ||
+ | $port=443; | ||
+ | $username="<API_USER>"; | ||
+ | $password="<API_USER_PASSWORD>"; | ||
+ | $api_path="/"; | ||
+ | $srv_id=1337; | ||
+ | $graph_mode=0; | ||
+ | $graph_language="en"; | ||
+ | //defines the function | ||
+ | function server_get_traffic_graph($host,$port,$username,$password,$api_path,$srv_id,$graph_mode,$graph_language) | ||
+ | { | ||
+ | //creates the serverurl | ||
+ | $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; | ||
+ | //----------creates the message which will be send to the server---------- | ||
+ | //creates the request for the XML-RPC Server | ||
+ | $request = new xmlrpcmsg('server.get_traffic_graph'); | ||
+ | //adds parameters to the request | ||
+ | $request->addParam | ||
+ | ( | ||
+ | //creates a value of type struct which contains an array with the username and password | ||
+ | new xmlrpcval | ||
+ | ( | ||
+ | array | ||
+ | ( | ||
+ | //creates a value of type string which contains the "$username" | ||
+ | 'login' => new xmlrpcval($username, 'string'), | ||
+ | //creates a value of type string which contains the "$password" | ||
+ | 'password' => new xmlrpcval($password, 'string'), | ||
+ | //creates a value | ||
+ | 'srv_id' => new xmlrpcval($srv_id, 'int'), | ||
+ | //creates a value | ||
+ | 'graph_mode' => new xmlrpcval($graph_mode), | ||
+ | //creates a value | ||
+ | 'graph_language' => new xmlrpcval($graph_language), | ||
+ | ) | ||
+ | ,'struct' | ||
+ | ) | ||
+ | ); | ||
+ | //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- | ||
+ | //creates the client | ||
+ | $client = new xmlrpc_client($serverurl); | ||
+ | //disable SSL Keycheck | ||
+ | $client->setSSLVerifyPeer(0); | ||
+ | //----------sends the request to the server and gets the response---------- | ||
+ | //sends the request via https and writes it into $response. timeout is set to 0 | ||
+ | $response = $client->send($request,0,'https'); | ||
+ | //generates a storable representation of $response and writes it into $result_xml | ||
+ | //echo $response->serialize(); | ||
+ | //checks the response. if the method "faultCode" returns zero, the response was succesfull | ||
+ | if (0==$response->faultCode()) | ||
+ | { | ||
+ | //returns the value sent by the server | ||
+ | $value = $response->value(); | ||
+ | //returns the actual PHP-language value of "value" | ||
+ | $result_obj = $value->scalarval(); | ||
+ | //destroys "value" | ||
+ | unset($value); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | //returns the faultCode and the faultString | ||
+ | return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); | ||
+ | } | ||
+ | //destroys "client" | ||
+ | unset($client); | ||
+ | //destroys "response" | ||
+ | unset($response); | ||
+ | //----------reads the result_obj---------- | ||
+ | //if result_obj is set then it returns the actual PHP-language value of "result_obj" | ||
+ | if (isset($result_obj['status'])) | ||
+ | { | ||
+ | $value['status'] = $result_obj['status']->scalarval(); | ||
+ | } | ||
+ | if (isset($result_obj['traffic_graph'])) | ||
+ | { | ||
+ | $value['traffic_graph'] = $result_obj['traffic_graph']->scalarval(); | ||
+ | } | ||
+ | return $value; | ||
+ | } | ||
+ | //calls the function | ||
+ | $result = server_get_traffic_graph($host,$port,$username,$password,$api_path,$srv_id,$graph_mode,$graph_language); | ||
+ | if(0==$result['faultCode']) | ||
+ | { | ||
+ | echo "Status: ".$result['status']."<br><br><img src='data:image/png;base64,".$result['traffic_graph']."'>"; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; | ||
+ | } | ||
+ | ?> | ||
+ | </nowiki> | ||
+ | |||
+ | == Domain-related Methods == | ||
+ | === domain.get_domain_orders === | ||
+ | ==== PURPOSE ==== | ||
+ | This method is used to give you an overview of your domain orders an their features. | ||
+ | |||
+ | ==== CALL PARAMETERS ==== | ||
+ | N/A | ||
+ | |||
+ | ==== RETURNS ==== | ||
+ | {|width="100%" cellspacing="0" border="2px solid" | ||
+ | |- | ||
+ | |'''Field / Key Name''' ||'''Type''' || '''Description''' | ||
+ | |- | ||
+ | |domain_orders||array asoc ||Contains domain order data | ||
+ | |} | ||
+ | |||
+ | ==== Keys of the second dimension ==== | ||
+ | {|width="100%" cellspacing="0" border="2px solid" | ||
+ | |- | ||
+ | |'''Field / Key Name''' ||'''Type''' || '''Description''' | ||
+ | |- | ||
+ | |<order_id> || array asoc ||Contains domain order data | ||
+ | |} | ||
+ | |||
+ | ==== Key of the third dimension ==== | ||
+ | {|width="100%" cellspacing="0" border="2px solid" | ||
+ | |- | ||
+ | |'''Field / Key Name''' ||'''Type''' || '''Description''' | ||
+ | |- | ||
+ | |domain_id||int||The id of the current domain. | ||
+ | |- | ||
+ | |domain_name||string||The name of the current domain. | ||
+ | |- | ||
+ | |domain_name_idn||string||The name idn of the current domain. | ||
+ | |- | ||
+ | |feature_redirect||int||Tells you, if the redirect feature is disabled or enabled(0/1). | ||
+ | |- | ||
+ | |feature_dns||int||Tells you, if the redirect feature is disabled or enabled(0/1). | ||
+ | |} |
Version vom 14:02, 31. Aug. 2012
EUserv Reseller API
Introduction
Technology
Our API is based on the XML-RPC protocol, which is a Remote Procedure Calling protocol that works over the Internet.
XML-RPC messages are HTTP-POST requests in XML (Extensible Markup Language).
A “method call” will be executed on the server and will produce a response, which is also formatted in XML and which can be decoded into several variables.
Method call parameters and returned variables can be strings, integers (numbers) and also complex types like arrays and hashes. Required parameters and return values are method-specific. Some parameters or return values are marked as “optional”; all other values/parameters are required.
API Servers
Please note that both servers currently use self-signed SSL certificates! It is possible, that you have to disable “peer verifying” to connect!
The live environment is available over HTTPS (HTTP over SSL, Port 443) at:
– https://api.euserv.net:443
For developing/testing purposes, please use the sandbox environment, which is also available over HTTPS(Port 443) at:
– https://api.test.euserv.net:443
The sandbox environment is a virtual environment for testing and developing. All data/values/servers/orders will be copied into the sandbox environment every night, excepting the API user accounts. That means you have to create separate API user accounts within the sandbox environment. Assigned tasks, e.g. server resets or reinstallations, will automatically marked as done every 5 minutes.
PHP Examples
We have added PHP examples to show you, how you can use our API with PHP. In our examples, we use 'XML-RPC for PHP' as the core libary. You can find this libary here:
http://phpxmlrpc.sourceforge.net/.
Method Specifications
Introduction
The following part contains information about method calls, method parameters and method return values.
Generally, if a method call was completed successfully, the return message will include the following status code:
Field | Type | Value |
status | int | 100 |
If a method call was failed, a XML-Fault message with “Fault-Code” and “Fault-String” will be returned.(See also chapter “XML Fault-Codes”)
API Debug/Testing Methods
debug.get_api_version
PURPOSE
This Method returns the current API version.
CALL PARAMETERS
N/A
RETURNS
Field | Type | Description |
api_version | string | Current API version |
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; //defines the function function debug_get_api_version($host,$port,$username,$password,$api_path) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('debug.get_api_version'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string') ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //$result_xml = $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj['api_version'])) { $value['api_version'] = $result_obj['api_version']->scalarval(); } return $value; } //calls the function $result = debug_get_api_version($host,$port,$username,$password,$api_path); if(0==$result['faultCode']) { echo "Status: ".$result['status']." API-Version: ".$result['api_version']; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
debug.pingpong
PURPOSE
This Method returns all the parameters, it was called with. You can use it to check the format of your call parameters. Notice that only supported parameter keys with correctly formatted values will be accepted!
CALL PARAMETERS
Every supported parameter key; see parameters of other methods.
RETURNS
Every committed parameter with its committed value.
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $parameter="srv_id"; $wert = "1337"; //defines the function function debug_pingpong($host,$port,$username,$password,$api_path,$parameter,$wert) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('debug.pingpong'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value of type string which contains the "$parameter" $parameter => new xmlrpcval($wert) ) ,'struct' ) ); //----------creates the XML-RPC client which represents a client of a XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //$result_xml = $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj[$parameter])) { $value[$parameter] = $result_obj[$parameter]->scalarval(); } return $value; } //calls the function $result = debug_pingpong($host,$port,$username,$password,$api_path,$parameter,$wert); if(!($result['faultCode'])) { echo "Status: ".$result['status']." ".$parameter.": ".$result[$parameter]; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
API User-Management Methods
usermngt.create_acc
PURPOSE
This Method is used to create new API user accounts
CALL PARAMETERS
Field / Key Name | Type | Description |
acc_sub_id | string | Name of the new account; will be attached to management account's name separated by a point. (e.g. 'subacc' will become api123.subacc) Required are 3-8 chars [a-z] or [0-9] |
acc_passwd_base64 | string base64 | Password for the new account (has to be base64-encoded) acc_ipv4_bindings string At least one allowed IPv4 address for using the new account. You can specify multiple values; each separated by a semicolon. Network-addresses and IPranges will not work. |
acc_allowed_groups (optional) | string | Method group memberships for this account. Management account needs permissions for every mentioned group. You can specify multiple |
RETURNS
Field / Key Name | Type | Description |
acc_name | string | The complete name of the new account (e.g. 'api1234.subacc') |
acc_added_ip_bindings | int | Number (amount) of added IP bindings |
acc_added_groups | int | Number (amount) of added group memberships |
usermngt.modify_acc
PURPOSE
This Method is used to modify settings and/or permissions of API user accounts.
CALL PARAMETERS
Field / Key Name | Type | Description |
acc_id | string | Complete name of the account which will be modified (e.g. 'acc_id' => 'api1234.subacc') |
acc_passwd_base64 (optional) | string base64 | New account password in base64-encoded format. Using this parameter will overwrite the old password. |
acc_ipv4_bindings (optional) | string | At least one allowed IPv4 address for using the new account. You can specify multiple values; each separated by a semicolon. Networkaddresses and IP-ranges will not work. You can specify multiple values, each separated by a semicolon. Using this parameter will overwrite old bindings. |
acc_allowed_groups (optional) | string | This parameter will set method group memberships for the account and overwrite existing ones. Management account needs permissions for every mentioned group. You can specify multiple values, each separated by a semicolon. (e.g. 'acc_allowed_groups' => 'domain;server;vserver') |
acc_status (optional) | string enum | Parameter to deactivate or to (re-)activate theParameter to deactivate or to (re-)activate the account Value must be “active” or “inactive” |
RETURNS
Field / Key Name | Type | Description |
acc_password_changed | bool | Shows if password has changed or not |
acc_ip_bindings_changed | bool | Shows if IP bindings have changed or not |
acc_groups_changed | bool | Shows if group memberships have changed or not |
acc_status_changed | bool | Shows if account's status has changed or not (has set active or inactive) |
usermngt.list_acc
PURPOSE
This Method is used to get all API user accounts and their settings/details
CALL PARAMETERS
N/A
RETURNS
Field / Key Name | Type | Description |
acc_list_count | int | Number (amount) of available API user accounts |
acc_list_data | array asoc | Contains all the account data in a multidimensional, associative array. Array’s keys equals API user’s login names, e.g. $array ['api1234.subacc'] Values are contained in the second dimension, e.g. $array ['api1234.subacc'] ['status'] |
acc_list_data – Keys of second dimension
Key Name | Type | Description |
status | string | Account’s status, can be “active” or “inactive” |
created | string | “Datetime” of account creation |
lastchange | string | “Datetime” of account’s last change groups array Contains all active method group names (e.g. 0 => “server”, 1 => “vserver”) |
ip_bindings | array | Contains all active IP bindings (IP restrictions) |
Server-related Methods
server.list_servers
PURPOSE
This Method is used to get all manageable servers and basic details for further method calls. Only these servers which are manageable by the used API user will be returned.
CALL PARAMETERS
N/A
RETURNS
Field / Key Name | Type | Description |
server_list_count | int | Number (amount) of available servers |
server_list_data | array asoc | Contains basic server details in a multidimensional, associative array. Keys of the first dimension equals the server order numbers: e.g. $array ['123456'] Values are contained in the second dimension: e.g. $array ['12345'] ['srv_main_ip'] returns the main |
server_list_data – Keys of second dimension
Key Name | Type | Description |
order_desc | string | Description/Product name |
srv_id | int | Server’s unique ID (required for further method calls) |
srv_main_ip | string | Primary IP address |
srv_name | string | Server name (for network settings) |
status | string enum | Server or order status: - “ready” means server can be used - “in_rescue” means server can be used but it’s currently in rescue mode - “in_process” means server is not available at present - “locked” means server/order is locked by the provider |
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; //defines the function function server_list_servers($host,$port,$username,$password,$api_path) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.list_servers'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), ) ,'struct' ) ); //----------creates the XML-RPC client which represents a client of a XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //$result_xml = $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj['server_list_count'])) { $value['server_list_count'] = $result_obj['server_list_count']->scalarval(); } if (isset($result_obj['server_list_data'])) { $i=0; //reads the data do { //gets the server_order_number $number = $result_obj['server_list_data']->structEach(); $i=$i+1; $data = $result_obj['server_list_data']->scalarval(); //reads the value off the server_order_number $data = $data[$number[0]]->scalarval(); //reads the value of each member and writes it into an array $server_list_data[$number[0]]['srv_name'] = $data['srv_name']->scalarval(); $server_list_data[$number[0]]['srv_id'] = $data['srv_id']->scalarval(); $server_list_data[$number[0]]['order_desc'] = $data['order_desc']->scalarval(); $server_list_data[$number[0]]['srv_main_ip'] = $data['srv_main_ip']->scalarval(); $server_list_data[$number[0]]['status'] = $data['status']->scalarval(); } while($i<$value['server_list_count']); //writes the array "server_list_data" into the array "value" $value['server_list_data'] = $server_list_data; } return $value; } //calls the function $result = server_list_servers($host,$port,$username,$password,$api_path); if(0==$result['faultCode']) { echo "Status: ".$result['status']." server_list_count: ".$result['server_list_count']."<br><br>"; //writes the array "server_list_data" into "daten" $daten = $result["server_list_data"]; //gets the array_keys(members) of "daten" $datenkeys = array_keys($daten); $k=0; //counts the arraykeys, the number of arraykeys will be used in the do-while construct $anzahlkeys = count($datenkeys); do { //outputs the data echo " <u>server_order_number:</u> ".$datenkeys[$k]; echo " <u>srv_name:</u> ".$daten[$datenkeys[$k]]['srv_name']; echo " <u>srv_id:</u> ".$daten[$datenkeys[$k]]['srv_id']; echo " <u>order_desc:</u> ".$daten[$datenkeys[$k]]['order_desc']; echo " <u>srv_main_ip:</u> ".$daten[$datenkeys[$k]]['srv_main_ip']; echo " <u>status:</u> ".$daten[$datenkeys[$k]]['status']; echo "<br>"; $k=$k+1; } while($k<$anzahlkeys); } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.get_details
PURPOSE
This Method is used to get all details of a manageable server. Only these servers are available, which are manageable by the used API.
CALL PARAMETERS
Field / Key Name | Type | Description |
srv_id | int | Server's unique ID |
RETURNS
Field / Key Name | Type | Description |
server_details | array (asoc) | Contains all server details in an associative array |
server_details – Keys of second dimension
Key Name | Type | Description |
order_no | int | Server contract’s order number |
order_desc | string | Description/Product name |
srv_id | int | Server’s unique ID (required for further method calls) |
srv_main_ip | string | Primary IP address |
srv_name | string | Server name (for network settings) |
srv_netmask | string | Netmask for network / IP address setup |
srv_broadcast | string | Broadcast address for network / IP address setup |
srv_gateway | string | Gateway address for network / IP address setup |
srv_status | string enum | Server or order status: - “ready” means server can be used - “in_rescue” means server is currently in rescue mode - “in_process” means server is not available at present - “locked” means server/order is locked by the provider |
srv_default_pw | string | Default password for initial login or rescue usage |
srv_mac | string | MAC-Address of server’s first network device |
srv_mac2 (optional) | string | MAC-Address of server’s optional second network device |
srv_cpu | string | Processor (Product) name / Description |
srv_cpu_cores | int | Number of (available) CPU cores |
srv_cpu_mhz | int | CPU clock rate in MHz srv_64bit_support bool CPU support for 64bit (true or false) |
srv_ram_type | string | Type of used memory (e.g. DDR2-RAM) |
srv_ram_size | int | Size of memory in MB |
srv_hdd_type | string | Harddisk bus type (e.g. SATA) |
srv_hdd_size | int | Size of each hdd (e.g. 250) |
srv_hdd_count | int | Number of installed harddisks |
srv_has_hwraid | bool | Hardware-RAID support (true or false) |
srv_hwraid_level | string | Used Hardware-RAID level (“none” or level, e.g. “1”) |
srv_os_id | int | ID of currently used OS image (for reinstall) |
srv_os_name | string | Name/description of currently used OS image |
srv_os_is_64bit | bool | OS image 64bit support (true or false) |
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $srv_id=1337; //defines the function function server_get_details($host,$port,$username,$password,$api_path,$srv_id) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.get_details'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value 'srv_id' => new xmlrpcval($srv_id, 'int'), ) ,'struct' ) ); //----------creates the XML-RPC client which represents a client of a XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj['server_details'])) { //resets the internal pointer for structEach() to the beginning of the struct $result_obj['server_details']->structreset(); //reads the keys and values and list returns an array. if no keys and values are read out list returns no array and the while-loop stops execution while (list($keyname, $data) = $result_obj['server_details']->structEach()) { $server_details[$keyname] = $data->scalarval(); //writes the array "server_list_data" into the array "value" $value['server_details'] = $server_details; } return $value; } //calls the function $result = server_get_details($host,$port,$username,$password,$api_path,$srv_id); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br>"; //writes the array "server_details" into "daten" $daten = $result["server_details"]; //gets the array_keys(members) of "daten" $datenkeys = array_keys($daten); $k=0; //counts the arraykeys, the number of arraykeys will be used in the do-while construct $anzahlkeys = count($datenkeys); do { echo " <u>".$datenkeys[$k].":</u> ".$daten[$datenkeys[$k]]; echo "<br>"; $k=$k+1; } while($k<$anzahlkeys); } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.get_possible_os_images
PURPOSE
This Method is used to get all possible OS images for a specific server ID. Only compatible and usable OS images will be returned here.
CALL PARAMETERS
Field / Key Name | Type | Description |
srv_id | int | Server's unique ID |
RETURNS
Field / Key Name | Type | Description |
os_images_asoc_array | array asoc | Contains details of every possible/available OS image in a multidimensional, associative array. Keys of the first dimension equals the OS image number, called “os_id”: e.g. $array ['240'] Values are contained in the second dimension: e.g. $array ['240'] ['os_name'] returns the name/description of OS image with ID 240. |
os_images_asoc_array – Keys of second dimension
Key Name | Type | Description |
os_id | int | ID of OS image (for reinstall) |
os-status | string enum | testing | unstable |
os_name | string | Name/description of OS image |
os_is_64bit | bool | OS image 64bit support (true or false) |
os_raidlevel | int | Provided software RAID level or “-1” if none |
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $srv_id=1337; //defines the function function server_get_possible_os_images($host,$port,$username,$password,$api_path,$srv_id) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.get_possible_os_images'); $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value of type string which contains the "$srv_id" 'srv_id' => new xmlrpcval($srv_id, 'int'), ) ,'struct' ) ); //----------creates the XML-RPC client which represents a client of a XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj['os_images_asoc_array'])) { //reads the data while (list($os_images, $data) = $result_obj['os_images_asoc_array']->structEach()) { //gets the "os_images" $data = $data->scalarval(); //reads the value of each member and writes it into an array $os_images_asoc_array[$os_images]['os_id'] = $data['os_id']->scalarval(); $os_images_asoc_array[$os_images]['os_status'] = $data['os_status']->scalarval(); $os_images_asoc_array[$os_images]['os_name'] = $data['os_name']->scalarval(); $os_images_asoc_array[$os_images]['os_is_64bit'] = $data['os_is_64bit']->scalarval(); $os_images_asoc_array[$os_images]['os_raidlevel'] = $data['os_raidlevel']->scalarval(); } //writes the array into the array "value" $value['os_images_asoc_array'] = $os_images_asoc_array; } return $value; } //calls the function $result = server_get_possible_os_images($host,$port,$username,$password,$api_path,$srv_id); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br>"; //writes the array "os_images_asoc_array" into "daten" $daten = $result["os_images_asoc_array"]; //gets the array_keys(members) of "daten" $datenkeys = array_keys($daten); $k=0; //counts the arraykeys, the number of arraykeys will be used in the do-while construct $anzahlkeys = count($datenkeys); do { //outputs the data echo " <u>os_id:</u> ".$daten[$datenkeys[$k]]['os_id']; echo " <u>os_status:</u> ".$daten[$datenkeys[$k]]['os_status']; echo " <u>os_name:</u> ".$daten[$datenkeys[$k]]['os_name']; echo " <u>os_is_64bit:</u> ".$daten[$datenkeys[$k]]['os_is_64bit']; echo " <u>os_raidlevel:</u> ".$daten[$datenkeys[$k]]['os_raidlevel']; echo "<br>"; $k=$k+1; } while($k<$anzahlkeys); } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.reset
PURPOSE
This Method is used to perform a hard server reset.
CALL PARAMETERS
Field / Key Name | Type | Description |
srv_id | int | Server’s unique ID |
RETURNS
Only “status” = “100” if request was accepted
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $srv_id=1337; //defines the function function server_reset($host,$port,$username,$password,$api_path,$srv_id) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.reset'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value of type string which contains the "$srv_id" 'srv_id' => new xmlrpcval($srv_id, 'int'), ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } return $value; } //calls the function $result = server_reset($host,$port,$username,$password,$api_path,$srv_id); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br>"; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.autoreinstall
PURPOSE
This Method is used to perform an automatic server reinstall with a specified OS image ID. Only compatible images will be accepted – you can obtain a list of all compatible OS images by using the “server.get_possible_os_images” API method.
CALL PARAMETERS
Field / Key Name | Type | Description |
srv_id | int | Server’s unique ID |
srv_os_id | int | ID of target OS image |
srv_perform_reset | bool | Perform automatic server reset, to start installation? (“true” or “false”) If you choose “false” here, you have to perform |
RETURNS
Only “status” = “100” if request was accepted
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $srv_id=1337; $srv_os_id=1337; $srv_perform_reset='true'; //defines the function function server_autoreinstall($host,$port,$username,$password,$api_path,$srv_id,$srv_os_id,$srv_perform_reset) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.autoreinstall'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value 'srv_id' => new xmlrpcval($srv_id, 'int'), //creates a value 'srv_os_id' => new xmlrpcval($srv_os_id, 'int'), //creates a value 'srv_perform_reset' => new xmlrpcval($srv_perform_reset), ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } return $value; } //calls the function $result = server_autoreinstall($host,$port,$username,$password,$api_path,$srv_id,$srv_os_id,$srv_perform_reset); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br>"; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.rescue_activate
PURPOSE
This Method is used to activate a rescue system for a specified server, which will be started during next boot.
CALL PARAMETERS
Field / Key Name | Type | Description |
srv_id | int | Server's unique ID |
srv_perform_reset | bool | Perform automatic server reset, to start rescue system? (“true” or “false”) If you choose “false” here, you have to perform a manual reboot via SSH to start the rescue system. |
RETURNS
Only “status” = “100” if request was accepted
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $srv_id=1337; $srv_perform_reset='true'; //defines the function function server_rescue_activate($host,$port,$username,$password,$api_path,$srv_id,$srv_perform_reset) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.rescue_activate'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value of type string which contains the "$srv_id" 'srv_id' => new xmlrpcval($srv_id, 'int'), //creates a value of type string which contains the "$srv_id" 'srv_perform_reset' => new xmlrpcval($srv_perform_reset), ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } } //calls the function $result = server_rescue_activate($host,$port,$username,$password,$api_path,$srv_id,$srv_perform_reset); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br>"; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.ipaddr_get_reverse
PURPOSE
This Method is used to get the current reverse DNS entry (PTR record) for a specified server IP address.
CALL PARAMETERS
Field / Key Name | Type | Description |
srv_id | int | Server's unique ID |
ip_address | string | IP address to get reverse entry for |
RETURNS
Field / Key Name | Type | Description |
ip_address | string | IP address for delivered record |
ptr_reverse_record | string | Reverse entry (PTR record) |
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $srv_id=1337; $ip_address="127.0.0.1"; //defines the function function server_ipaddr_get_reverse($host,$port,$username,$password,$api_path,$srv_id,$ip_address) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.ipaddr_get_reverse'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value 'srv_id' => new xmlrpcval($srv_id, 'int'), //creates a value 'ip_address' => new xmlrpcval($ip_address, 'string'), ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj['ip_address'])) { $value['ip_address'] = $result_obj['ip_address']->scalarval(); } if (isset($result_obj['ptr_reverse_record'])) { $value['ptr_reverse_record'] = $result_obj['ptr_reverse_record']->scalarval(); } return $value; } //calls the function $result = server_ipaddr_get_reverse($host,$port,$username,$password,$api_path,$srv_id,$ip_address); if(0==$result['faultCode']) { //outputs the data echo "Status: ".$result['status']."<br><br>"; echo "ip_address: ".$result['ip_address']."<br>"; echo "ptr_reverse_record: ".$result['ptr_reverse_record']."<br>"; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.ipaddr_set_reverse
PURPOSE
This Method is used to set a reverse DNS entry for a specified server IP address.
CALL PARAMETERS
Field / Key Name | Type | Description |
srv_id | int | Server's unique ID |
ipa_address | string | IP address to modify reverse entry |
reverse_entry | string | Reverse entry for specified IP as hostname/ |
RETURNS
Only “status” = “100” if request was accepted
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $srv_id=1337; $ip_address="127.0.0.1"; $reverse_entry="euserv.de"; //defines the function function server_ipaddr_set_reverse($host,$port,$username,$password,$api_path,$srv_id,$ip_address,$reverse_entry) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.ipaddr_set_reverse'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value 'srv_id' => new xmlrpcval($srv_id, 'int'), //creates a value 'ip_address' => new xmlrpcval($ip_address, 'string'), //creates a value 'reverse_entry' => new xmlrpcval($reverse_entry, 'string'), ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } return $value; } //calls the function $result = server_ipaddr_set_reverse($host,$port,$username,$password,$api_path,$srv_id,$ip_address,$reverse_entry); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br>"; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?> </nowikiw> === server.get_possible_server_items === ==== PURPOSE ==== This Method is used to display all possible server-items you can order. Please note that this function only available for Reseller. ==== CALL PARAMETERS ==== N/A ==== RETURNS ==== {|width="100%" cellspacing="0" border="2px solid" |- |'''Field / Key Name''' ||'''Type''' || '''Description''' |- |possible_server_items||array (asoc)||Contains all possible serveritems in a associative array |} ==== possible_server_items - Keys of second dimension ==== {|width="100%" cellspacing="0" border="2px solid" |- |'''Key Name''' ||'''Type''' || '''Description''' |- |item_id||int||Server-item unique ID |- |item_name||string||The name of the server-item |- |item_net_amount||string||The net amount of the serveritem (per billing period) |- |item_gross_amount||string||The gross amount of the serveritem (per billing period) |- |item_net_setup_fee||string||The net setup fee (unique) of the server-item |- |item_gross_setup_fee||string||The gross setup fee (unique) of the server-item |- |item_billing_period||int||The period you have to pay for your server (in months) |- |item_contract_running_time||int||The running time of the contract |} ==== METHOD ERRORS ==== {|width="100%" cellspacing="0" border="2px solid" |- |'''Code''' ||'''Short Message''' || '''Description''' |- |1001||can not load customer_id||Error while loading the customer_id from api-user. Please contact the support! |1002||can not load as_id||Error while loading the as_id from api-user. Please contact the support! |1003||internal error||Internal error. Please contact the support! |1004||no possible items found||There are no possible serveritems you can order. |1005||this function is only available for reseller||You are not a reseller, you can not use this function. |} ==== PHP EXAMPLE ==== <nowiki> <?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; //defines the function function server_get_possible_server_items($host,$port,$username,$password,$api_path) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.get_possible_server_items'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj['possible_server_items'])) { //resets the internal pointer for structEach() to the beginning of the struct $result_obj['possible_server_items']->structreset(); //reads the keys and values and list returns an array. if no keys and values are read out list returns no array and the while-loop stops execution while (list($keyname, $data) = $result_obj['possible_server_items']->structEach()) { //gets the "server_items" $data= $data->scalarval(); //reads the value of each member and writes it into an array $server_items[$keyname]['item_id'] = $data['item_id']->scalarval(); $server_items[$keyname]['item_name'] = $data['item_name']->scalarval(); $server_items[$keyname]['item_net_amount'] = $data['item_net_amount']->scalarval(); $server_items[$keyname]['item_gross_amount'] = $data['item_gross_amount']->scalarval(); $server_items[$keyname]['item_net_setup_fee'] = $data['item_net_setup_fee']->scalarval(); $server_items[$keyname]['item_gross_setup_fee'] = $data['item_net_setup_fee']->scalarval(); $server_items[$keyname]['item_billing_period'] = $data['item_billing_period']->scalarval(); $server_items[$keyname]['item_contract_running_time'] = $data['item_contract_running_time']->scalarval(); } //writes the array "server_list_data" into the array "value" $value['possible_server_items'] = $server_items; } return $value; } //calls the function $result = server_get_possible_server_items($host,$port,$username,$password,$api_path); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br>"; //writes the array "server_details" into "daten" $daten = $result["possible_server_items"]; //gets the array_keys(members) of "daten" $datenkeys = array_keys($daten); $k=0; //counts the arraykeys, the number of arraykeys will be used in the do-while construct $anzahlkeys = count($datenkeys); do { //outputs the data echo " <u>item_id:</u> ".$daten[$datenkeys[$k]]['item_id']; echo " <u>item_name:</u> ".$daten[$datenkeys[$k]]['item_name']; echo " <u>item_net_amount:</u> ".$daten[$datenkeys[$k]]['item_net_amount']; echo " <u>item_gross_amount:</u> ".$daten[$datenkeys[$k]]['item_gross_amount']; echo " <u>item_net_setup_fee:</u> ".$daten[$datenkeys[$k]]['item_net_setup_fee']; echo " <u>item_gross_setup_fee:</u> ".$daten[$datenkeys[$k]]['item_gross_setup_fee']; echo " <u>item_billing_period:</u> ".$daten[$datenkeys[$k]]['item_billing_period']; echo " <u>item_contract_running_time:</u> ".$daten[$datenkeys[$k]]['item_contract_running_time']; echo "<br>"; $k=$k+1; } while($k<$anzahlkeys); } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.order_server
PURPOSE
This method is used to order some server. Please note that this function only available for Reseller.
CALL PARAMETERS
Field / Key Name | Type | Description |
<item_id> | int | Use the item_id of the serveritem you want to order as a key and the quantity of the server as the value eg. '11716' => '1' (order one server with the item_id '11716') |
accept_terms_and_conditions | bool | Set this flag to accept the terms and conditions(0 = NO, 1= YES). If you don't accept the terms and conditions, you can't order server. The terms and conditions can be found here: http://euserv.de/unternehmen/agb.php |
accept_special_terms_and_conditions_rootserver | bool | Set this flag to accept the spezial terms and conditions rootserver(0 = NO, 1= YES). If you don't accept the spezial terms and conditions rootserver, you can't order server. The spezial terms and conditions rootserver can be found here: http://euserv.de/produkte/server/tosfdrs.php |
RETURNS
Field / Key Name | Type | Description |
total_amount | string | The total amount for the server you have ordered |
METHOD ERRORS
Code | Short Message | Description |
1001 | can not load customer_id | Error while loading the customer_id from api-user. Please contact the support! |
1002 | can not load a_id | Error while laoding the as_id from api-user. Please contact the support! |
1003 | terms and conditions must be accepted | To order server you must accept the terms and conditions. |
1004 | special terms and conditions rootserver must be accepted | To order server you must accept the spezial terms and conditions rootserver. |
1005 | internal error | Internal error. Please contact the support! |
1006 | no items found | No items found. Please check your request. |
1007 | internal error | Internal error. Please contact the support! |
1008 | invalid item_id found | One of your item-ids is invalid. Please check your request. |
1009 | internal error | Internal error. Please contact the support! |
1010 | this function is only available for reseller | You are not a reseller, you can not use this function. |
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $item_id=array('1337' => '1' , '1338' => '2'); $accept_terms_and_conditions=1; $accept_special_terms_and_conditions_rootserver=1; //defines the function function server_order_server($host,$port,$username,$password,$api_path,$item_id,$accept_terms_and_conditions, $accept_special_terms_and_conditions_rootserver) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.order_server'); $keys = array_keys($item_id); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value of type string which contains the "$srv_id" $keys[0] => new xmlrpcval($item_id[$keys[0]]), //creates a value of type string which contains the "$srv_id" $keys[1] => new xmlrpcval($item_id[$keys[1]]), //creates a value of type string which contains the "$srv_id" 'accept_terms_and_conditions' => new xmlrpcval($accept_terms_and_conditions), //creates a value of type string which contains the "$srv_id" 'accept_special_terms_and_conditions_rootserver' => new xmlrpcval($accept_special_terms_and_conditions_rootserver), ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj['total_amount'])) { $value['total_amount'] = $result_obj['total_amount']->scalarval(); } return $value; } //calls the function $result = server_order_server($host,$port,$username,$password,$api_path,$item_id,$accept_terms_and_conditions, $accept_special_terms_and_conditions_rootserver); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br>".$result['total_amount']; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
server.get_traffic_graph
PURPOSE
This method is used to get a traffic-graph for your server.
CALL PARAMETERS
Field / Key Name | Type | Description |
srv_id | int | The id of the server for which you want to get a traffic-graph. |
graph_mode(optional) | int | The mode of the graph you want to get (0 = LAST DAY, 1 = LAST WEEK,2 = LAST MONTH,3 = LAST YEAR). |
graph_language(optional) | string | The language of the graph you want to get (ISO Country Code, lower case). Possible types are 'en', 'de'. Default is 'en'. |
RETURNS
Field / Key Name | Type | Description |
traffic_graph | string | The base64 encoded data of the graph you want to get. |
METHOD ERRORS
Code | Short Message | Description |
1001 | srv_id not given | The srv_id was not given. |
1002 | srv_graph_mode not valid | The given srv_graph_mode is not valid. |
1003 | can not load portdata | Cannot load portdata, please contact the support! |
1004 | can not load portdata | Cannot load portdata, please contact the support! |
1005 | can not load portdata | Cannot load portdata, please contact the support! |
PHP EXAMPLE
<?php //includes the class library include_once("lib/xmlrpc.inc"); $xmlrpc_internalencoding = 'UTF-8'; $host="api.test.euserv.net"; $port=443; $username="<API_USER>"; $password="<API_USER_PASSWORD>"; $api_path="/"; $srv_id=1337; $graph_mode=0; $graph_language="en"; //defines the function function server_get_traffic_graph($host,$port,$username,$password,$api_path,$srv_id,$graph_mode,$graph_language) { //creates the serverurl $serverurl = 'https://'.$host.':'.$port.'/'.$api_path; //----------creates the message which will be send to the server---------- //creates the request for the XML-RPC Server $request = new xmlrpcmsg('server.get_traffic_graph'); //adds parameters to the request $request->addParam ( //creates a value of type struct which contains an array with the username and password new xmlrpcval ( array ( //creates a value of type string which contains the "$username" 'login' => new xmlrpcval($username, 'string'), //creates a value of type string which contains the "$password" 'password' => new xmlrpcval($password, 'string'), //creates a value 'srv_id' => new xmlrpcval($srv_id, 'int'), //creates a value 'graph_mode' => new xmlrpcval($graph_mode), //creates a value 'graph_language' => new xmlrpcval($graph_language), ) ,'struct' ) ); //----------creates the XML-RPC client which represent a client of an XML-RPC server---------- //creates the client $client = new xmlrpc_client($serverurl); //disable SSL Keycheck $client->setSSLVerifyPeer(0); //----------sends the request to the server and gets the response---------- //sends the request via https and writes it into $response. timeout is set to 0 $response = $client->send($request,0,'https'); //generates a storable representation of $response and writes it into $result_xml //echo $response->serialize(); //checks the response. if the method "faultCode" returns zero, the response was succesfull if (0==$response->faultCode()) { //returns the value sent by the server $value = $response->value(); //returns the actual PHP-language value of "value" $result_obj = $value->scalarval(); //destroys "value" unset($value); } else { //returns the faultCode and the faultString return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString()); } //destroys "client" unset($client); //destroys "response" unset($response); //----------reads the result_obj---------- //if result_obj is set then it returns the actual PHP-language value of "result_obj" if (isset($result_obj['status'])) { $value['status'] = $result_obj['status']->scalarval(); } if (isset($result_obj['traffic_graph'])) { $value['traffic_graph'] = $result_obj['traffic_graph']->scalarval(); } return $value; } //calls the function $result = server_get_traffic_graph($host,$port,$username,$password,$api_path,$srv_id,$graph_mode,$graph_language); if(0==$result['faultCode']) { echo "Status: ".$result['status']."<br><br><img src='data:image/png;base64,".$result['traffic_graph']."'>"; } else { echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString']; } ?>
Domain-related Methods
domain.get_domain_orders
PURPOSE
This method is used to give you an overview of your domain orders an their features.
CALL PARAMETERS
N/A
RETURNS
Field / Key Name | Type | Description |
domain_orders | array asoc | Contains domain order data |
Keys of the second dimension
Field / Key Name | Type | Description |
<order_id> | array asoc | Contains domain order data |
Key of the third dimension
Field / Key Name | Type | Description |
domain_id | int | The id of the current domain. |
domain_name | string | The name of the current domain. |
domain_name_idn | string | The name idn of the current domain. |
feature_redirect | int | Tells you, if the redirect feature is disabled or enabled(0/1). |
feature_dns | int | Tells you, if the redirect feature is disabled or enabled(0/1). |