API Documentation/en

Aus EUserv Wiki

Wechseln zu: Navigation, Suche

Inhaltsverzeichnis


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/.

History of Changes

Version Changes
0.5.1 - Add method 'server.ipaddr_get_reverse'
- Add method 'server.get_possible_server_items'
- Add method 'server.order_server'
0.5.2 - Update method 'server.get_possible_server_items'
- Update method 'server.order_server'
0.5.3 - Add method 'domain.get_domain_orders'
- Add method'domain.get_domain_order_details'
- Add method 'domain.dns_create_record'

- Add method 'domain.dns_delete_record'
- Add method 'domain.dns_update_record'
- Add method 'domain.dns_get_active_records'
- Add method 'domain.redirect_create_record'
- Add method 'domain.redirect_delete_record'
- Add method 'domain.redirect_update_record'
- Add method 'domain.redirect_get_active_records'
- Add internal methods

0.5.4 - Add method 'server.get_traffic_graph'
- Update internal methods


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