Introduction
Our HTTP REST API allows you to manage vital details of your account and services in client portal. JSON is used for all API returns
Use left menu to browse trough available methods, use right menu to check required parameters, data to post and code samples in various languages.
Swagger Doc: You can download or display the JSON to generate documentation in Swagger.
Authentication
Basic Authentication
# pass the correct header with each request (-u option)
curl 'https://cp.xsserver.gmbh/api/details' \
-u "username:password"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/details');
# python requests module handles basic authentication if provided with auth parameter
payload = username
req = requests.get('https://cp.xsserver.gmbh/api/details', auth=('username', 'password'))
print(req.json())
Make sure to replace
username
andpassword
with your client area details.
This authentication method requires that you send your client area username (email address) and password with each request.
API calls that require authentication expect a header in the form of
Authorization: Basic <credentials>
, where credentials is the Base64 encoding
of username and password joined by a single colon :
.
For example:
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
You can find more info on this authentication method here: Basic HTTP Authentication
Clientarea
Login
Generate new authorization token
curl -X POST "https://cp.xsserver.gmbh/api/login" \
-H "Content-Type: application/json" \
-d "{
\"username\": \"user@example.com\",
\"password\": \"secret\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->post('/login', [
'json' => [
"username" => "user@example.com",
"password" => "secret"
]
]);
echo $resp->getBody();
payload = {
'username': "user@example.com",
'password': "secret"
}
req = requests.post('https://cp.xsserver.gmbh/api/login', json=payload)
print(req.json())
Example Response:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRw(...)5lZ9T79ft9uwOkqRRmIBbtR51_w",
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIzMD(...)ChwIAb3zvxBu6kvULa2AwAt9U-I"
}
HTTP Request
POST /login
Query Parameters
Parameter | Type | Description |
---|---|---|
username | string |
Your acount email address |
password | string |
Account password |
Logout
Invalidate authorization token
curl -X POST "https://cp.xsserver.gmbh/api/logout" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/logout');
echo $resp->getBody();
auth=('username', 'password')
req = requests.post('https://cp.xsserver.gmbh/api/logout', auth=auth)
print(req.json())
Example Response:
{
"status": true
}
HTTP Request
POST /logout
Refresh Token
Generate new authorization token using refresh token
curl -X POST "https://cp.xsserver.gmbh/api/token" \
-H "Content-Type: application/json" \
-d "{
\"refresh_token\": \"refresh_tokenValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->post('/token', [
'json' => [
"refresh_token" => "refresh_tokenValue"
]
]);
echo $resp->getBody();
payload = {
'refresh_token': "refresh_tokenValue"
}
req = requests.post('https://cp.xsserver.gmbh/api/token', json=payload)
print(req.json())
Example Response:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHR(...)vY2xlYiHGvauCWZD9B0VwXgHEzXDllqY",
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJBQ(...)Rmivc_u3YA_kgDqOPtUuGNXOzueXYtZw"
}
HTTP Request
POST /token
Query Parameters
Parameter | Type | Description |
---|---|---|
refresh_token | string |
Refresh token previously obtained from |
Revoke Token
Invalidate authorization and refresh token. Pass refresh token or call this method with valid access token
curl -X POST "https://cp.xsserver.gmbh/api/revoke" \
-H "Content-Type: application/json" \
-d "{
\"refresh_token\": \"refresh_tokenValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->post('/revoke', [
'json' => [
"refresh_token" => "refresh_tokenValue"
]
]);
echo $resp->getBody();
payload = {
'refresh_token': "refresh_tokenValue"
}
req = requests.post('https://cp.xsserver.gmbh/api/revoke', json=payload)
print(req.json())
Example Response:
{
"status": true
}
HTTP Request
POST /revoke
Query Parameters
Parameter | Type | Description |
---|---|---|
refresh_token | string |
User Details
Return registration details for my account
curl -X GET "https://cp.xsserver.gmbh/api/details" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/details');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://cp.xsserver.gmbh/api/details', auth=auth)
print(req.json())
Example Response:
{
"client": {
"id": "26",
"email": "api@example.com",
"lastlogin": "2016-12-30 12:24:28",
"ip": "172.100.2.1",
"host": "hostname",
"firstname": "Joe",
"lastname": "Doe",
"companyname": "",
"address1": "Pretty View Lane",
"address2": "3294",
"city": "Santa Rosa",
"state": "California",
"postcode": "95401",
"country": "US",
"phonenumber": "+1.24123123"
}
}
HTTP Request
GET /details
Billing
Account balance
Get current account balance(unpaid invoices total), account credit
curl -X GET "https://cp.xsserver.gmbh/api/balance" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/balance');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://cp.xsserver.gmbh/api/balance', auth=auth)
print(req.json())
Example Response:
{
{
"success": true,
"details": {
"currency": "USD",
"acc_balance": "123456.55",
"acc_credit": "0.00"
}
}
}
HTTP Request
GET /balance
List Invoices
List all invoices under my account
curl -X GET "https://cp.xsserver.gmbh/api/invoice" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/invoice');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://cp.xsserver.gmbh/api/invoice', auth=auth)
print(req.json())
Example Response:
{
"invoices": [
{
"id": "308976",
"date": "2016-12-30",
"dateorig": "2016-12-30",
"duedate": "2017-01-06",
"paybefore": "2017-01-06",
"total": "19.65",
"datepaid": "2016-12-30 12:40:47",
"status": "Paid",
"merge_id": null,
"number": "2016\/12\/1",
"currency": "USD"
}
]
}
HTTP Request
GET /invoice
Invoice Details
Get invoice details
curl -X GET "https://cp.xsserver.gmbh/api/invoice/@id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/invoice/@id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://cp.xsserver.gmbh/api/invoice/@id', auth=auth)
print(req.json())
Example Response:
{
"invoice": {
"id": "308976",
"status": "Paid",
"date": "2016-12-30",
"duedate": "2017-01-06",
"paybefore": "2017-01-06",
"datepaid": "2016-12-30 12:40:47",
"subtotal": 16.24,
"credit": 0,
"tax": 3.41,
"taxrate": 21,
"tax2": 0,
"taxrate2": 0,
"taxexempt": "0",
"total": 19.65,
"rate": 1,
"rate2": 0,
"rate3": 1,
"notes": "",
"items": [
{
"id": "12305",
"invoice_id": "308976",
"type": "Other",
"item_id": "0",
"description": "Example Service",
"amount": "15.00",
"taxed": "1",
"qty": "1.00",
"linetotal": "15.00"
},
{
"id": "12309",
"invoice_id": "308976",
"type": "Other",
"item_id": "-2",
"description": "PayPal Payment Fee",
"amount": "1.24",
"taxed": "1",
"qty": "1.00",
"linetotal": "1.24"
}
],
"client": {
"id": "26",
"email": "api@example.com",
"firstname": "Joe",
"lastname": "Doe",
"companyname": "",
"address1": "Pretty View Lane",
"address2": "3194",
"city": "Santa Rosa",
"state": "California",
"postcode": "95401",
"country": "US",
"phonenumber": "+1.24123123"
},
"number": "2016\/12\/1",
"currency": "USD"
}
}
HTTP Request
GET /invoice/@id
Query Parameters
Parameter | Type | Description |
---|---|---|
id | int |
Support
List Tickets
List support tickets under my account
curl -X GET "https://cp.xsserver.gmbh/api/tickets" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/tickets');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://cp.xsserver.gmbh/api/tickets', auth=auth)
print(req.json())
Example Response:
{
"tickets": [
{
"client_read": "1",
"ticket_number": "736633",
"date": "2016-12-30 12:48:13",
"deptname": "Billing",
"subject": "Lore Ipsum",
"status": "Open"
}
]
}
HTTP Request
GET /tickets
Ticket details
Get ticket details, including all replies
curl -X GET "https://cp.xsserver.gmbh/api/tickets/@number" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/tickets/@number');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://cp.xsserver.gmbh/api/tickets/@number', auth=auth)
print(req.json())
Example Response:
{
"ticket": {
"date": "2016-12-30 12:48:13",
"ticket_number": "736633",
"name": "Joe Doe",
"email": "api@example.com",
"subject": "Lore Ipsum",
"body": "Donec sollicitudin molestie malesuada. \r\nSed porttitor lectus nibh. Vivamus magna justo, \r\nlacinia eget consectetur sed, convallis at tellus.",
"status": "Answered",
"client_read": "1",
"deptname": "Billing"
},
"replies": [
{
"id": "929",
"name": "Suppport Staff",
"date": "2016-12-30 12:51:04",
"body": "Vestibulum ac diam sit amet quam \r\nvehicula elementum sed sit amet dui. \r\nPraesent sapien massa\r\n\r\n-- Maecenas efficitur elit est --",
"status": "Sent",
"type": "Admin"
}
]
}
HTTP Request
GET /tickets/@number
Query Parameters
Parameter | Type | Description |
---|---|---|
number | int |
Ticket number |
Create Ticket
Submit new ticket
curl -X POST "https://cp.xsserver.gmbh/api/tickets" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"dept_id\": 1,
\"subject\": \"Subject\",
\"body\": \"Message ...\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/tickets', [
'json' => [
"dept_id" => 1,
"subject" => "Subject",
"body" => "Message ..."
]
]);
echo $resp->getBody();
payload = {
'dept_id': 1,
'subject': "Subject",
'body': "Message ..."
}
auth=('username', 'password')
req = requests.post('https://cp.xsserver.gmbh/api/tickets', json=payload, auth=auth)
print(req.json())
Example Response:
{
"ticket": 865650
}
HTTP Request
POST /tickets
Query Parameters
Parameter | Type | Description |
---|---|---|
dept_id | int |
Department id |
subject | string |
Ticket subject |
body | string |
Ticket message |
Create Reply
Reply to ticket
curl -X POST "https://cp.xsserver.gmbh/api/tickets/@number" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"body\": \"reply text ..\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/tickets/@number', [
'json' => [
"body" => "reply text .."
]
]);
echo $resp->getBody();
payload = {
'body': "reply text .."
}
auth=('username', 'password')
req = requests.post('https://cp.xsserver.gmbh/api/tickets/@number', json=payload, auth=auth)
print(req.json())
Example Response:
{
"info": [
"reply_added"
]
}
HTTP Request
POST /tickets/@number
Query Parameters
Parameter | Type | Description |
---|---|---|
number | int |
Ticket number |
body | string |
Reply message |
Re-open ticket
Try to re-open closed ticket
curl -X PUT "https://cp.xsserver.gmbh/api/tickets/@number/open" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/tickets/@number/open');
echo $resp->getBody();
auth=('username', 'password')
req = requests.put('https://cp.xsserver.gmbh/api/tickets/@number/open', auth=auth)
print(req.json())
Example Response:
{
"status": true
}
HTTP Request
PUT /tickets/@number/open
Query Parameters
Parameter | Type | Description |
---|---|---|
number | int |
Ticket number |
Close ticket
Send request to close a ticket
curl -X PUT "https://cp.xsserver.gmbh/api/tickets/@number/close" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/tickets/@number/close');
echo $resp->getBody();
auth=('username', 'password')
req = requests.put('https://cp.xsserver.gmbh/api/tickets/@number/close', auth=auth)
print(req.json())
Example Response:
{
"status": true
}
HTTP Request
PUT /tickets/@number/close
Query Parameters
Parameter | Type | Description |
---|---|---|
number | int |
Ticket number |
List ticket departments
Get the list of ticket departments
curl -X GET "https://cp.xsserver.gmbh/api/ticket/departments" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/ticket/departments');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://cp.xsserver.gmbh/api/ticket/departments', auth=auth)
print(req.json())
HTTP Request
GET /ticket/departments
Services
IP Addresses
List Service IP Addresses
curl -X GET "https://cp.xsserver.gmbh/api/service/@id/ip"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->get('/service/@id/ip');
echo $resp->getBody();
req = requests.get('https://cp.xsserver.gmbh/api/service/@id/ip')
print(req.json())
HTTP Request
GET /service/@id/ip
Query Parameters
Parameter | Type | Description |
---|---|---|
id | int |
Service ID |
Reverse DNS
Get reverse DNS entries for service's IP addresses
curl -X GET "https://cp.xsserver.gmbh/api/service/@id/rdns"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->get('/service/@id/rdns');
echo $resp->getBody();
req = requests.get('https://cp.xsserver.gmbh/api/service/@id/rdns')
print(req.json())
HTTP Request
GET /service/@id/rdns
Query Parameters
Parameter | Type | Description |
---|---|---|
id | int |
Service ID |
Update rDNS
Update reverse DNS entries service's IP addresses
curl -X POST "https://cp.xsserver.gmbh/api/service/@id/rdns" \
-H "Content-Type: application/json" \
-d "{
\"ipaddress\": {
\"key\": \"value\"
}
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->post('/service/@id/rdns', [
'json' => [
"ipaddress" => [
"key" => "value"
]
]
]);
echo $resp->getBody();
payload = {
'ipaddress': {
'key': "value"
}
}
req = requests.post('https://cp.xsserver.gmbh/api/service/@id/rdns', json=payload)
print(req.json())
HTTP Request
POST /service/@id/rdns
Query Parameters
Parameter | Type | Description |
---|---|---|
id | int |
Service ID |
ipaddress | array |
Use Ip address as parameter key and hostname as value |
PDU ports
List PDU ports assigned to service
curl -X GET "https://cp.xsserver.gmbh/api/service/@id/pdu"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->get('/service/@id/pdu');
echo $resp->getBody();
req = requests.get('https://cp.xsserver.gmbh/api/service/@id/pdu')
print(req.json())
HTTP Request
GET /service/@id/pdu
Query Parameters
Parameter | Type | Description |
---|---|---|
id | int |
Service id |
PDU Port state
Get PDU port/outlet state
curl -X GET "https://cp.xsserver.gmbh/api/service/@id/pdu/@port"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->get('/service/@id/pdu/@port');
echo $resp->getBody();
req = requests.get('https://cp.xsserver.gmbh/api/service/@id/pdu/@port')
print(req.json())
HTTP Request
GET /service/@id/pdu/@port
Query Parameters
Parameter | Type | Description |
---|---|---|
id | int |
Service id |
port | int |
Port id |
Set PDU port status
Set PDU port/outlet state
curl -X POST "https://cp.xsserver.gmbh/api/service/@id/pdu/@port" \
-H "Content-Type: application/json" \
-d "{
\"power\": \"powerValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.xsserver.gmbh/api',
]);
$resp = $client->post('/service/@id/pdu/@port', [
'json' => [
"power" => "powerValue"
]
]);
echo $resp->getBody();
payload = {
'power': "powerValue"
}
req = requests.post('https://cp.xsserver.gmbh/api/service/@id/pdu/@port', json=payload)
print(req.json())
HTTP Request
POST /service/@id/pdu/@port
Query Parameters
Parameter | Type | Description |
---|---|---|
id | int |
Service id |
port | int |
Port id |
power | bool |
Desired power state - 'true' for ON or 'false' for OFF |