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://billing.hostens.com/api/details' \
-u "username:password"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/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://billing.hostens.com/api/details', auth=('username', 'password'))
print(req.json())
Make sure to replace
usernameandpasswordwith 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
Refresh Token
Generate new authorization token using refresh token
curl -X POST "https://billing.hostens.com/api/token" \
-H "Content-Type: application/json" \
-d "{
\"refresh_token\": \"refresh_tokenValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
]);
$resp = $client->post('/token', [
'json' => [
"refresh_token" => "refresh_tokenValue"
]
]);
echo $resp->getBody();
payload = {
'refresh_token': "refresh_tokenValue"
}
req = requests.post('https://billing.hostens.com/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://billing.hostens.com/api/revoke" \
-H "Content-Type: application/json" \
-d "{
\"refresh_token\": \"refresh_tokenValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
]);
$resp = $client->post('/revoke', [
'json' => [
"refresh_token" => "refresh_tokenValue"
]
]);
echo $resp->getBody();
payload = {
'refresh_token': "refresh_tokenValue"
}
req = requests.post('https://billing.hostens.com/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://billing.hostens.com/api/details" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/details');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/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
Update User Details
Update registration details under my account
curl -X PUT "https://billing.hostens.com/api/details" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"type\": \"typeValue\",
\"companyname\": \"companynameValue\",
\"companyregistrationnumber\": \"companyregistrationnumberValue\",
\"vateu\": \"vateuValue\",
\"email\": \"emailValue\",
\"firstname\": \"firstnameValue\",
\"lastname\": \"lastnameValue\",
\"country\": \"countryValue\",
\"address1\": \"address1Value\",
\"city\": \"cityValue\",
\"state\": \"stateValue\",
\"postcode\": \"postcodeValue\",
\"phonenumber\": \"phonenumberValue\",
\"emarketing\": \"emarketingValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/details', [
'json' => [
"type" => "typeValue",
"companyname" => "companynameValue",
"companyregistrationnumber" => "companyregistrationnumberValue",
"vateu" => "vateuValue",
"email" => "emailValue",
"firstname" => "firstnameValue",
"lastname" => "lastnameValue",
"country" => "countryValue",
"address1" => "address1Value",
"city" => "cityValue",
"state" => "stateValue",
"postcode" => "postcodeValue",
"phonenumber" => "phonenumberValue",
"emarketing" => "emarketingValue"
]
]);
echo $resp->getBody();
payload = {
'type': "typeValue",
'companyname': "companynameValue",
'companyregistrationnumber': "companyregistrationnumberValue",
'vateu': "vateuValue",
'email': "emailValue",
'firstname': "firstnameValue",
'lastname': "lastnameValue",
'country': "countryValue",
'address1': "address1Value",
'city': "cityValue",
'state': "stateValue",
'postcode': "postcodeValue",
'phonenumber': "phonenumberValue",
'emarketing': "emarketingValue"
}
auth=('username', 'password')
req = requests.put('https://billing.hostens.com/api/details', json=payload, auth=auth)
print(req.json())
Example Response:
{
"client": {
"id": "26",
"email": "api@example.com",
"lastlogin": "2016-12-30 12:34:20",
"ip": "172.100.2.1",
"host": "hostname",
"firstname": "Joe",
"lastname": "Doe",
"companyname": "",
"address1": "Pretty View Lane",
"address2": "3194",
"city": "Santa Rosa",
"state": "California",
"postcode": "95401",
"country": "US",
"phonenumber": "+1.24123123"
},
"info": [
"client_info_updated"
]
}
HTTP Request
PUT /details
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| type | string |
Account Type
Available values:
|
| companyname | string |
Organization |
| companyregistrationnumber | string |
Organization Registration Number |
| vateu | string |
VAT Number - If you have valid VAT-EU registered number please provide it here |
string |
Email Address |
|
| firstname | string |
First Name
Value pattern: |
| lastname | string |
Last Name
Value pattern: |
| country | string |
Country |
| address1 | string |
Address 1
Value pattern: |
| city | string |
City
Value pattern: |
| state | string |
State - Maximum 20 characters.
Value pattern: |
| postcode | string |
Post code |
| phonenumber | string |
Phone - It can be used to reset your password if lost. |
| emarketing | string[] |
News and Updates - You will be subscribed to our newsletter list and will receive updates and news regarding Hostens services.
Available values:
|
List contacts
Return a list of contacts on this account
curl -X GET "https://billing.hostens.com/api/contact" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/contact');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/contact', auth=auth)
print(req.json())
Example Response:
{
"contacts": [
{
"email": "mary@example.com",
"id": "49",
"firstname": "Mary",
"lastname": "Sue",
"companyname": "",
"company": "0",
"lastlogin": "0000-00-00 00:00:00"
}
]
}
HTTP Request
GET /contact
Add contact
Create new contact account, if password is provided you can use provided email addres to login as that contact.
curl -X POST "https://billing.hostens.com/api/contact" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"password\": \"passwordValue\",
\"privileges\": \"privilegesValue\",
\"type\": \"typeValue\",
\"companyname\": \"companynameValue\",
\"companyregistrationnumber\": \"companyregistrationnumberValue\",
\"vateu\": \"vateuValue\",
\"email\": \"emailValue\",
\"firstname\": \"firstnameValue\",
\"lastname\": \"lastnameValue\",
\"country\": \"countryValue\",
\"address1\": \"address1Value\",
\"city\": \"cityValue\",
\"state\": \"stateValue\",
\"postcode\": \"postcodeValue\",
\"phonenumber\": \"phonenumberValue\",
\"emarketing\": \"emarketingValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/contact', [
'json' => [
"password" => "passwordValue",
"privileges" => "privilegesValue",
"type" => "typeValue",
"companyname" => "companynameValue",
"companyregistrationnumber" => "companyregistrationnumberValue",
"vateu" => "vateuValue",
"email" => "emailValue",
"firstname" => "firstnameValue",
"lastname" => "lastnameValue",
"country" => "countryValue",
"address1" => "address1Value",
"city" => "cityValue",
"state" => "stateValue",
"postcode" => "postcodeValue",
"phonenumber" => "phonenumberValue",
"emarketing" => "emarketingValue"
]
]);
echo $resp->getBody();
payload = {
'password': "passwordValue",
'privileges': "privilegesValue",
'type': "typeValue",
'companyname': "companynameValue",
'companyregistrationnumber': "companyregistrationnumberValue",
'vateu': "vateuValue",
'email': "emailValue",
'firstname': "firstnameValue",
'lastname': "lastnameValue",
'country': "countryValue",
'address1': "address1Value",
'city': "cityValue",
'state': "stateValue",
'postcode': "postcodeValue",
'phonenumber': "phonenumberValue",
'emarketing': "emarketingValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/contact', json=payload, auth=auth)
print(req.json())
Example Response:
{
"contact_id": "1",
"info": [
"profile_added"
]
}
HTTP Request
POST /contact
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| password | string |
Optional, allows you to login as contact |
| privileges | array |
Array with privileges that you want to enable. Formatted the same way as output from |
| type | string |
Account Type
Available values:
|
| companyname | string |
Organization |
| companyregistrationnumber | string |
Organization Registration Number |
| vateu | string |
VAT Number - If you have valid VAT-EU registered number please provide it here |
string |
Email Address |
|
| firstname | string |
First Name
Value pattern: |
| lastname | string |
Last Name
Value pattern: |
| country | string |
Country |
| address1 | string |
Address 1
Value pattern: |
| city | string |
City
Value pattern: |
| state | string |
State - Maximum 20 characters.
Value pattern: |
| postcode | string |
Post code |
| phonenumber | string |
Phone - It can be used to reset your password if lost. |
| emarketing | string[] |
News and Updates - You will be subscribed to our newsletter list and will receive updates and news regarding Hostens services.
Available values:
|
Contact privileges
List possible contact privileges.
Each domain and service may list additional privileges, depending on available features.
curl -X GET "https://billing.hostens.com/api/contact/privileges" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/contact/privileges');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/contact/privileges', auth=auth)
print(req.json())
Example Response:
{
"privileges": {
"billing": [
"emails", // Receive billing notifications
"payinvoice", // Allow to view/pay invoices
"orders", // Allow to place new orders
"balance", // View account balance
"addfunds", // Add account funds
"creditcard" // Edit Credit Card details
],
"support": [
"newticket", // Open new tickets
"tickets", // View all tickets
"closeticket", // Close tickets
"emails" // Receive email notifications from support
],
"misc": [
"editmain", // Modify main profile details
"emails", // View emails history
"editipaccess", // Edit allowed IP access
"manageprofiles", // Add / Edit contacts
"affiliates" // Access affiliates section
],
"services": {
"full": 1, // Full control over services
"332": [
"basic", // View basic details
"billing", // View billing info
"cancelation", // Request cancellation
"upgrade", // Upgrade / Downgrade
"notify", // Receive related email notifications
(...)
"logindetails"
]
},
"domains": {
"full": 1, // Full control over domains
"523": [
"basic", // View basic details
"renew", // Renew domain
"notify", // Receive related email notifications
"contactinfo", // Contact Information
(...)
"nameservers" // Manage Nameservers
]
}
}
}
HTTP Request
GET /contact/privileges
Get contacts details
Return array with contact details
curl -X GET "https://billing.hostens.com/api/contact/@id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/contact/@id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/contact/@id', auth=auth)
print(req.json())
Example Response:
{
"contact": {
"id": "49",
"email": "mary@example.com",
"firstname": "Mary",
"lastname": "Sue",
"companyname": "",
"address1": "Pretty View Lane",
"address2": "3194",
"city": "Santa Rosa",
"state": "California",
"postcode": "95401",
"country": "US",
"phonenumber": "+1.24123123",
"type": "Private",
"privileges" : {
"support" : ["tickets", "newticket"]
}
}
}
HTTP Request
GET /contact/@id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Contact ID |
Edit contact
Change contact details`
curl -X PUT "https://billing.hostens.com/api/contact/@id" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"privileges\": \"privilegesValue\",
\"type\": \"typeValue\",
\"companyname\": \"companynameValue\",
\"companyregistrationnumber\": \"companyregistrationnumberValue\",
\"vateu\": \"vateuValue\",
\"email\": \"emailValue\",
\"firstname\": \"firstnameValue\",
\"lastname\": \"lastnameValue\",
\"country\": \"countryValue\",
\"address1\": \"address1Value\",
\"city\": \"cityValue\",
\"state\": \"stateValue\",
\"postcode\": \"postcodeValue\",
\"phonenumber\": \"phonenumberValue\",
\"emarketing\": \"emarketingValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/contact/@id', [
'json' => [
"privileges" => "privilegesValue",
"type" => "typeValue",
"companyname" => "companynameValue",
"companyregistrationnumber" => "companyregistrationnumberValue",
"vateu" => "vateuValue",
"email" => "emailValue",
"firstname" => "firstnameValue",
"lastname" => "lastnameValue",
"country" => "countryValue",
"address1" => "address1Value",
"city" => "cityValue",
"state" => "stateValue",
"postcode" => "postcodeValue",
"phonenumber" => "phonenumberValue",
"emarketing" => "emarketingValue"
]
]);
echo $resp->getBody();
payload = {
'privileges': "privilegesValue",
'type': "typeValue",
'companyname': "companynameValue",
'companyregistrationnumber': "companyregistrationnumberValue",
'vateu': "vateuValue",
'email': "emailValue",
'firstname': "firstnameValue",
'lastname': "lastnameValue",
'country': "countryValue",
'address1': "address1Value",
'city': "cityValue",
'state': "stateValue",
'postcode': "postcodeValue",
'phonenumber': "phonenumberValue",
'emarketing': "emarketingValue"
}
auth=('username', 'password')
req = requests.put('https://billing.hostens.com/api/contact/@id', json=payload, auth=auth)
print(req.json())
Example Response:
{
"info": [
"profile_updated"
]
}
HTTP Request
PUT /contact/@id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
|
| privileges | array |
Array with privileges that you want to enable. Formatted the same way as output from |
| type | string |
Account Type
Available values:
|
| companyname | string |
Organization |
| companyregistrationnumber | string |
Organization Registration Number |
| vateu | string |
VAT Number - If you have valid VAT-EU registered number please provide it here |
string |
Email Address |
|
| firstname | string |
First Name
Value pattern: |
| lastname | string |
Last Name
Value pattern: |
| country | string |
Country |
| address1 | string |
Address 1
Value pattern: |
| city | string |
City
Value pattern: |
| state | string |
State - Maximum 20 characters.
Value pattern: |
| postcode | string |
Post code |
| phonenumber | string |
Phone - It can be used to reset your password if lost. |
| emarketing | string[] |
News and Updates - You will be subscribed to our newsletter list and will receive updates and news regarding Hostens services.
Available values:
|
List all portal notifications
Return a list of all portal notifications.
curl -X GET "https://billing.hostens.com/api/notifications" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/notifications');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/notifications', auth=auth)
print(req.json())
HTTP Request
GET /notifications
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| rel_type | string |
Optional, return only by relation type |
| rel_id | string |
Optional, return only by relation id |
List new portal notifications
Return only new portal notifications.
curl -X GET "https://billing.hostens.com/api/notifications/new" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/notifications/new');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/notifications/new', auth=auth)
print(req.json())
HTTP Request
GET /notifications/new
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| rel_type | string |
Optional, return only by relation type |
| rel_id | string |
Optional, return only by relation id |
Acknowledge notification
Marks the notification as read
curl -X PUT "https://billing.hostens.com/api/notifications/@id/ack" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/notifications/@id/ack');
echo $resp->getBody();
auth=('username', 'password')
req = requests.put('https://billing.hostens.com/api/notifications/@id/ack', auth=auth)
print(req.json())
HTTP Request
PUT /notifications/@id/ack
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Billing
Account balance
Get current account balance(unpaid invoices total), account credit
curl -X GET "https://billing.hostens.com/api/balance" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/balance');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/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://billing.hostens.com/api/invoice" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/invoice');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/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://billing.hostens.com/api/invoice/@id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/invoice/@id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/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 |
Payment Methods
List available payment methods
curl -X GET "https://billing.hostens.com/api/payment" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/payment');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/payment', auth=auth)
print(req.json())
Example Response:
{
"payments": {
"10": "BankTransfer",
"9": "PayPal"
}
}
HTTP Request
GET /payment
Payment Methods Fees
List available payment methods with fees
curl -X GET "https://billing.hostens.com/api/payment/fees" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/payment/fees');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/payment/fees', auth=auth)
print(req.json())
Example Response:
{
"payments": [
{
"id": 1,
"name": "Bank Transfer",
"fixed_fee": "0.0",
"percent_fee": "0.0",
},
{
"id": 2,
"name": "Stripe",
"fixed_fee": "0.5",
"percent_fee": "2.9",
},
{
"id": 4,
"name": "Credit Card",
"fixed_fee": "0.1",
"percent_fee": "2.4"
},
{
"id": 5,
"name": "PayPal",
"fixed_fee": "0.3",
"percent_fee": "2.9"
}
]
}
HTTP Request
GET /payment/fees
Domains
List Domains
List domains under your account
curl -X GET "https://billing.hostens.com/api/domain" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain', auth=auth)
print(req.json())
Example Response:
{
"domains": [
{
"id": "47",
"name": "testname.com",
"expires": "2017-12-30",
"recurring_amount": "15.00",
"date_created": "2016-12-30",
"status": "Active",
"period": "1",
"autorenew": "1",
"daytoexpire": "365"
}
]
}
HTTP Request
GET /domain
Domain details
Get domain details
curl -X GET "https://billing.hostens.com/api/domain/@id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/@id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/@id', auth=auth)
print(req.json())
Example Response:
{
"details": {
"id": "47",
"name": "testname.com",
"date_created": "2016-12-30",
"firstpayment": "10.00",
"recurring_amount": "15.00",
"period": "1",
"expires": "2017-12-30",
"status": "Active",
"next_due": "2017-12-30",
"next_invoice": "2017-11-30",
"idprotection": "0",
"nameservers": [
"ns1.example.com",
"ns2.example.com",
"ns3.example.com",
"ns4.example.com"
],
"autorenew": "1"
}
}
HTTP Request
GET /domain/@id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Domain details by name
Get domain details by name
curl -X GET "https://billing.hostens.com/api/domain/name/@name" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/name/@name');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/name/@name', auth=auth)
print(req.json())
Example Response:
{
"details": [
{
"id": "47",
"name": "testname.com",
"date_created": "2016-12-30",
"firstpayment": "10.00",
"recurring_amount": "15.00",
"period": "1",
"expires": "2017-12-30",
"status": "Active",
"next_due": "2017-12-30",
"next_invoice": "2017-11-30",
"idprotection": "0",
"nameservers": [
"ns1.example.com",
"ns2.example.com",
"ns3.example.com",
"ns4.example.com"
],
"autorenew": "1"
},
{
"id": "48",
"name": "testname.com",
"date_created": "2016-05-30",
"firstpayment": "10.00",
"recurring_amount": "15.00",
"period": "1",
"expires": "2017-05-30",
"status": "Expired",
"next_due": "2017-05-30",
"next_invoice": "2017-04-30",
"idprotection": "0",
"nameservers": [
"ns1.example.com",
"ns2.example.com",
"ns3.example.com",
"ns4.example.com"
],
"autorenew": "1"
},
]
}
HTTP Request
GET /domain/name/@name
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string |
Domain name |
Get domain nameservers
curl -X GET "https://billing.hostens.com/api/domain/@id/ns" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/@id/ns');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/@id/ns', auth=auth)
print(req.json())
HTTP Request
GET /domain/@id/ns
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Update domain nameservers
Change domain nameservers, if $nameservers is left empty, default namesevers will be used
curl -X PUT "https://billing.hostens.com/api/domain/@id/ns" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"nameservers\": \"nameserversValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/domain/@id/ns', [
'json' => [
"nameservers" => "nameserversValue"
]
]);
echo $resp->getBody();
payload = {
'nameservers': "nameserversValue"
}
auth=('username', 'password')
req = requests.put('https://billing.hostens.com/api/domain/@id/ns', json=payload, auth=auth)
print(req.json())
Example Response:
{
"info": [
"success_changes_save"
]
}
HTTP Request
PUT /domain/@id/ns
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
| nameservers | array |
List of nameservers to use |
Register domain nameservers
curl -X POST "https://billing.hostens.com/api/domain/@id/reg" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/domain/@id/reg');
echo $resp->getBody();
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/domain/@id/reg', auth=auth)
print(req.json())
HTTP Request
POST /domain/@id/reg
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Get domain EPP Code
curl -X GET "https://billing.hostens.com/api/domain/@id/epp" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/@id/epp');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/@id/epp', auth=auth)
print(req.json())
HTTP Request
GET /domain/@id/epp
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Synchronize domain
curl -X GET "https://billing.hostens.com/api/domain/@id/sync" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/@id/sync');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/@id/sync', auth=auth)
print(req.json())
HTTP Request
GET /domain/@id/sync
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Get domain lock
curl -X GET "https://billing.hostens.com/api/domain/@id/reglock" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/@id/reglock');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/@id/reglock', auth=auth)
print(req.json())
HTTP Request
GET /domain/@id/reglock
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Update domain lock
curl -X PUT "https://billing.hostens.com/api/domain/@id/reglock" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/domain/@id/reglock');
echo $resp->getBody();
auth=('username', 'password')
req = requests.put('https://billing.hostens.com/api/domain/@id/reglock', auth=auth)
print(req.json())
HTTP Request
PUT /domain/@id/reglock
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Get domain contact info
curl -X GET "https://billing.hostens.com/api/domain/@id/contact" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/@id/contact');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/@id/contact', auth=auth)
print(req.json())
HTTP Request
GET /domain/@id/contact
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Update domain contact info
curl -X PUT "https://billing.hostens.com/api/domain/@id/contact" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/domain/@id/contact');
echo $resp->getBody();
auth=('username', 'password')
req = requests.put('https://billing.hostens.com/api/domain/@id/contact', auth=auth)
print(req.json())
HTTP Request
PUT /domain/@id/contact
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Get domain autorenew
curl -X GET "https://billing.hostens.com/api/domain/@id/autorenew" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/@id/autorenew');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/@id/autorenew', auth=auth)
print(req.json())
HTTP Request
GET /domain/@id/autorenew
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Enable/disable domain autorenew
curl -X PUT "https://billing.hostens.com/api/domain/@id/autorenew" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/domain/@id/autorenew');
echo $resp->getBody();
auth=('username', 'password')
req = requests.put('https://billing.hostens.com/api/domain/@id/autorenew', auth=auth)
print(req.json())
HTTP Request
PUT /domain/@id/autorenew
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Domain id |
Domain availability
Check if domain is available for registration. Returns status: "ok" if domain is available, empty response otherwise
curl -X POST "https://billing.hostens.com/api/domain/lookup" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"name\": \"nameValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/domain/lookup', [
'json' => [
"name" => "nameValue"
]
]);
echo $resp->getBody();
payload = {
'name': "nameValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/domain/lookup', json=payload, auth=auth)
print(req.json())
Example Response:
{
"available": false,
"name": "example.com",
"premium": false,
"periods": [
{
"id": "6",
"period": "1",
"register": "10.00",
"transfer": "0.00",
"renew": "15.00",
"redemption": "40.00"
},
{
"id": "6",
"period": "2",
"register": "20.00",
"transfer": "20.00",
"renew": "20.00",
"redemption": "80.00"
}
]
}
HTTP Request
POST /domain/lookup
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string |
Domain name, ie. example.com |
Available TLDs
List TLDs available for registration and transfer
curl -X GET "https://billing.hostens.com/api/domain/order" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/order');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/order', auth=auth)
print(req.json())
Example Response:
{
"tlds": [
{
"id": "6",
"tld": ".com",
"periods": [
{
"period": "1",
"register": "10.00",
"transfer": "0.00",
"renew": "15.00",
"redemption": "40.00"
},
{
"period": "2",
"register": "20.00",
"transfer": "20.00",
"renew": "30.00",
"redemption": "80.00"
}
]
},
(...)
]
}
HTTP Request
GET /domain/order
Additinal data for TLD
Get additional forms required for some TLDs
curl -X GET "https://billing.hostens.com/api/domain/order/@id/form" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/domain/order/@id/form');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/domain/order/@id/form', auth=auth)
print(req.json())
Example Response:
{
"forms": [
{
"type": "domaindnssupport",
"title": "DNS Management",
"id": "1424",
"firstItemId": 9067,
"description": "",
"name": "custom[1424][9067]",
"required": false,
"multiple": false,
"config": {
"enableddefault": 0
},
"value": [],
"textvalue": [],
"price": 0,
"recurring_price": 0,
"setup": 0,
"prorata_date": null,
"items": [
{
"title": "",
"value": 1,
"id": 9067,
"price": 4,
"setup": 0,
"selected": false
}
]
},
{
"type": "select",
"title": "Language",
"id": "1755",
"firstItemId": 10952,
"description": "",
"name": "custom[1755]",
"required": false,
"multiple": false,
"config": {
"conditionals": []
},
"value": [],
"textvalue": [],
"price": 0,
"recurring_price": 0,
"setup": 0,
"prorata_date": null,
"items": [
{
"title": "AFR",
"value": 1,
"id": 10952,
"price": 0,
"setup": 0,
"selected": false
},
{
"title": "ALB",
"value": 1,
"id": 10953,
"price": 0,
"setup": 0,
"selected": false
},
(...)
]
}
]
}
HTTP Request
GET /domain/order/@id/form
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| tld_id | int |
TLD ID |
Order new domain
Create new order for a domain, please check if requested domain is available first, otherwise your order may get cancelled.
curl -X POST "https://billing.hostens.com/api/domain/order" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"name\": \"nameValue\",
\"years\": \"yearsValue\",
\"action\": \"actionValue\",
\"tld_id\": \"tld_idValue\",
\"pay_method\": \"pay_methodValue\",
\"epp\": \"eppValue\",
\"nameservers\": \"nameserversValue\",
\"registrant\": \"registrantValue\",
\"admin\": \"adminValue\",
\"tech\": \"techValue\",
\"billing\": \"billingValue\",
\"data\": \"dataValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/domain/order', [
'json' => [
"name" => "nameValue",
"years" => "yearsValue",
"action" => "actionValue",
"tld_id" => "tld_idValue",
"pay_method" => "pay_methodValue",
"epp" => "eppValue",
"nameservers" => "nameserversValue",
"registrant" => "registrantValue",
"admin" => "adminValue",
"tech" => "techValue",
"billing" => "billingValue",
"data" => "dataValue"
]
]);
echo $resp->getBody();
payload = {
'name': "nameValue",
'years': "yearsValue",
'action': "actionValue",
'tld_id': "tld_idValue",
'pay_method': "pay_methodValue",
'epp': "eppValue",
'nameservers': "nameserversValue",
'registrant': "registrantValue",
'admin': "adminValue",
'tech': "techValue",
'billing': "billingValue",
'data': "dataValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/domain/order', json=payload, auth=auth)
print(req.json())
Example Response:
{
"order_num": 563647679,
"invoice_id": "308977",
"total": "10.00",
"items": {
"id": "10",
"type": "Domain Register",
"name": "test.com",
"product_id": "3"
}
}
HTTP Request
POST /domain/order
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string |
Domain name, ie. example.com |
| years | string |
Number of years |
| action | string |
register|transfer |
| tld_id | string |
TLD id |
| pay_method | int |
Payment method ID |
| epp | string |
EPP Transfer code, required when transfering some domains |
| nameservers | array |
Optional array with 2 - 4 nameservers that you want to use |
| registrant | int |
Optional contact ID to use for registrant contact this domain |
| admin | int |
Optional contact ID to use for admin contact this domain |
| tech | int |
Optional contact ID to use for tech contact this domain |
| billing | int |
Optional contact ID to use for billing contact this domain |
| data | array |
Addditional data required for some TLDs |
Renew domain
Create new renew order for a domain, please check if requested domain is available first, otherwise your order may get cancelled.
curl -X POST "https://billing.hostens.com/api/domain/@id/renew" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"years\": \"yearsValue\",
\"pay_method\": \"pay_methodValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/domain/@id/renew', [
'json' => [
"years" => "yearsValue",
"pay_method" => "pay_methodValue"
]
]);
echo $resp->getBody();
payload = {
'years': "yearsValue",
'pay_method': "pay_methodValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/domain/@id/renew', json=payload, auth=auth)
print(req.json())
HTTP Request
POST /domain/@id/renew
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
|
| years | string |
Number of years |
| pay_method | int |
Payment method ID |
SSL Certificates
List SSL Certificates
List all ssl services under your account
curl -X GET "https://billing.hostens.com/api/certificate" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/certificate');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/certificate', auth=auth)
print(req.json())
Example Response:
{
"sslservices": [
{
"id": "300",
"domain": "examplename.com",
"total": "27.85",
"status": "Pending",
"billingcycle": "Annually",
"next_due": "2017-12-30",
"category": "GoGetSSL",
"category_url": "gogetssl",
"name": "Comodo InstantSSL",
"cert_email": "admin@example.com",
"cert_status": "",
"cert_expires": "2017-12-30 13:43:12"
}
]
}
HTTP Request
GET /certificate
Certificate details
Return details for certificate @id
curl -X GET "https://billing.hostens.com/api/certificate/@id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/certificate/@id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/certificate/@id', auth=auth)
print(req.json())
Example Response:
{
"service": {
"id": "300",
"date_created": "2016-12-30",
"domain": "examplename.com",
"firstpayment": "27.85",
"total": "27.85",
"billingcycle": "Annually",
"next_due": "2017-12-30",
"next_invoice": "2017-10-31",
"status": "Pending",
"label": "",
"name": "Comodo InstantSSL",
"cert_status": "",
"cert_expires": "2017-12-30 13:43:12",
"csr": "-----BEGIN CERTIFICATE REQUEST----- ...",
"contacts": {
"admin": {
"FName": "Mary",
"LName": "Sue",
"City": "Santa Rosa",
"State": "California",
"PostalCode": "95401",
"EmailAddress": "mary@example.com",
"Country": "US",
"Address1": "Pretty View Lane",
"Address2": "3194",
"Phone": 24123223,
"OrgName": "n\/a",
"PreFix": 1,
"JobTitle": "n\/a"
},
"billing": {
(...)
},
"tech": {
(...)
}
},
"organization": {
"state": "Texas",
"country": "US",
"name": "My Org name",
"unit": "Dev",
"locality": "SanAntonio",
"postalcode": "n\/a",
"address2": "n\/a",
"address1": "n\/a",
},
"cert_email": "admin@example.com",
"software": "1"
}
}
HTTP Request
GET /certificate/@id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
Download certificate
Return X.509 certificate data
curl -X GET "https://billing.hostens.com/api/certificate/@id/crt" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/certificate/@id/crt');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/certificate/@id/crt', auth=auth)
print(req.json())
HTTP Request
GET /certificate/@id/crt
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
List available certificates
Return a list with certificate available for purchase
curl -X GET "https://billing.hostens.com/api/certificate/order" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/certificate/order');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/certificate/order', auth=auth)
print(req.json())
Example Response:
{
"products": [
{
"id": "25",
"name": "InstantSSL",
"description": "",
"periods": [
{
"years": 1,
"price": 27.85,
"renew": 27.85
},
{
"years": 2,
"price": 48.75,
"renew": 48.75
}
],
"category": "SSL Certificates",
"category_url": "sslcertificates"
},
(...)
]
}
HTTP Request
GET /certificate/order
List server software for certificates
Return a list with software IDs required or certificate
curl -X GET "https://billing.hostens.com/api/certificate/order/@product_id/software" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/certificate/order/@product_id/software');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/certificate/order/@product_id/software', auth=auth)
print(req.json())
Example Response:
{
"software": [
{
"id": 0,
"name": "AOL"
},
{
"id": 1,
"name": "Apache-SSL (Ben-SSL, not Stronghold)"
},
(...)
]
}
HTTP Request
GET /certificate/order/@product_id/software
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | int |
Certificate product ID |
Order new certificates
Create new order for a certificate
curl -X POST "https://billing.hostens.com/api/certificate/order" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"product_id\": \"product_idValue\",
\"csr\": \"csrValue\",
\"years\": \"yearsValue\",
\"pay_method\": \"pay_methodValue\",
\"approver_email\": \"approver_emailValue\",
\"admin\": \"adminValue\",
\"tech\": \"techValue\",
\"billing\": \"billingValue\",
\"organization\": \"organizationValue\",
\"software\": \"softwareValue\",
\"data\": \"dataValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/certificate/order', [
'json' => [
"product_id" => "product_idValue",
"csr" => "csrValue",
"years" => "yearsValue",
"pay_method" => "pay_methodValue",
"approver_email" => "approver_emailValue",
"admin" => "adminValue",
"tech" => "techValue",
"billing" => "billingValue",
"organization" => "organizationValue",
"software" => "softwareValue",
"data" => "dataValue"
]
]);
echo $resp->getBody();
payload = {
'product_id': "product_idValue",
'csr': "csrValue",
'years': "yearsValue",
'pay_method': "pay_methodValue",
'approver_email': "approver_emailValue",
'admin': "adminValue",
'tech': "techValue",
'billing': "billingValue",
'organization': "organizationValue",
'software': "softwareValue",
'data': "dataValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/certificate/order', json=payload, auth=auth)
print(req.json())
Example Response:
{
"order_num": 873340994,
"invoice_id": "308978",
"total": "27.85",
"items": {
"id": "10",
"type": "Hosting",
"name": "test.com",
"product_id": "3"
}
}
HTTP Request
POST /certificate/order
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | int |
Certificate product ID |
| csr | string |
Domain name, ie. example.com |
| years | int |
Number of years |
| pay_method | int |
Payment method ID |
| approver_email | string |
Email addres used in domain validation |
| admin | int |
Admin contact ID |
| tech | int |
Tech contact ID |
| billing | int |
Billing contact ID |
| organization | array |
Organization details |
| software | int |
Server/Software ID |
| data | array |
Addditional data required for some products |
Services
List services
List all services under your account
curl -X GET "https://billing.hostens.com/api/service" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/service');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/service', auth=auth)
print(req.json())
Example Response:
{
"services": [
{
"id": "301",
"domain": "examplename.com",
"total": "9.99",
"status": "Pending",
"billingcycle": "Monthly",
"next_due": "2017-12-30",
"category": "Hosting",
"category_url": "hosting",
"name": "Starter Hosting"
}
]
}
HTTP Request
GET /service
Service details
Return details for service @id
curl -X GET "https://billing.hostens.com/api/service/@id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/service/@id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/service/@id', auth=auth)
print(req.json())
Example Response:
{
"service": {
"id": "301",
"date_created": "2016-12-30",
"domain": "examplename.com",
"firstpayment": "9.99",
"total": "9.99",
"billingcycle": "Monthly",
"next_due": "2017-12-30",
"next_invoice": "2017-01-27",
"status": "Active",
"label": "",
"username": "examplen",
"password": "pdtzc",
"name": "Starter Hosting"
}
}
HTTP Request
GET /service/@id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
List service methods
List methods available for service
curl -X GET "https://billing.hostens.com/api/service/@id/methods" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/service/@id/methods');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/service/@id/methods', auth=auth)
print(req.json())
Example Response:
{
"methods": [
{
"name": "Upgrade Request",
"method": "POST",
"route": "\/service\/@id\/upgrade"
},
{
"name": "Upgrade Options",
"method": "GET",
"route": "\/service\/@id\/upgrade"
},
{
"name": "Change service label",
"method": "POST",
"route": "\/service\/@id\/label"
},
{
"name": "Service label",
"method": "GET",
"route": "\/service\/@id\/label"
},
{
"name": "Cancel Service",
"method": "POST",
"route": "\/service\/@id\/cancel"
}
]
}
HTTP Request
GET /service/@id/methods
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Upgrade Options
List upgrade options
curl -X GET "https://billing.hostens.com/api/service/@id/upgrade" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/service/@id/upgrade');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/service/@id/upgrade', auth=auth)
print(req.json())
Example Response:
{
"resources": [
{
"id": 1557,
"name": "Bandwidth",
"type": "select",
"items": [
{
"id": "9953",
"name": "100 GB",
"price": 1,
"setup_price": 0,
"selected": true
},
{
"id": "10103",
"name": "500 GB",
"price": 5,
"setup_price": 0,
"selected": false
},
{
"id": "10104",
"name": "1 TB",
"price": 10,
"setup_price": 0,
"selected": false
}
]
}
],
"package": []
}
HTTP Request
GET /service/@id/upgrade
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Cancel Service
Request service cancellation
curl -X POST "https://billing.hostens.com/api/service/@id/cancel" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"immediate\": \"immediateValue\",
\"reason\": \"reasonValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/service/@id/cancel', [
'json' => [
"immediate" => "immediateValue",
"reason" => "reasonValue"
]
]);
echo $resp->getBody();
payload = {
'immediate': "immediateValue",
'reason': "reasonValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/service/@id/cancel', json=payload, auth=auth)
print(req.json())
Example Response:
{
"info": [
"cancell_sent"
]
}
HTTP Request
POST /service/@id/cancel
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
| immediate | string |
set to |
| reason | string |
Reason for this request |
Service label
Show current service label
curl -X GET "https://billing.hostens.com/api/service/@id/label" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/service/@id/label');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/service/@id/label', auth=auth)
print(req.json())
Example Response:
{
"label": "example"
}
HTTP Request
GET /service/@id/label
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
Change service label
Set new custom label to identify this service
curl -X POST "https://billing.hostens.com/api/service/@id/label" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"label\": \"labelValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/service/@id/label', [
'json' => [
"label" => "labelValue"
]
]);
echo $resp->getBody();
payload = {
'label': "labelValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/service/@id/label', json=payload, auth=auth)
print(req.json())
Example Response:
{
"success": true,
"info": [
"label_updated"
]
}
HTTP Request
POST /service/@id/label
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
| label | string |
New label |
Upgrade Request
Estimate or request upgrade
// Format of ''resources'' paremeter
{
"resource_id" : "qty_value", // sliders & qty fields
"resource_id" : "item_id", // dropdown & radio fields
"resource_id" : {
"item_id": "qty_value" // dropdown with qty field
}
}
curl -X POST "https://billing.hostens.com/api/service/@id/upgrade" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"resources\": \"resourcesValue\",
\"package\": \"packageValue\",
\"cycle\": \"cycleValue\",
\"send\": \"sendValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/service/@id/upgrade', [
'json' => [
"resources" => "resourcesValue",
"package" => "packageValue",
"cycle" => "cycleValue",
"send" => "sendValue"
]
]);
echo $resp->getBody();
payload = {
'resources': "resourcesValue",
'package': "packageValue",
'cycle': "cycleValue",
'send': "sendValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/service/@id/upgrade', json=payload, auth=auth)
print(req.json())
HTTP Request
POST /service/@id/upgrade
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
| resources | array |
array with resource values |
| package | int |
New package id, optonal when upgrading resources |
| cycle | string |
New billing cycle, optonal when upgrading resources |
| send | boolean |
Set to true when you want to send your upgrade request |
Get list statuses
Get a list of all statuses.
curl -X GET "https://billing.hostens.com/api/statuses"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
]);
$resp = $client->get('/statuses');
echo $resp->getBody();
req = requests.get('https://billing.hostens.com/api/statuses')
print(req.json())
HTTP Request
GET /statuses
Get specific statuses
Get a list of all statuses with specific status.
curl -X GET "https://billing.hostens.com/api/statuses/specific/@status"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
]);
$resp = $client->get('/statuses/specific/@status');
echo $resp->getBody();
req = requests.get('https://billing.hostens.com/api/statuses/specific/@status')
print(req.json())
HTTP Request
GET /statuses/specific/@status
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| status | string |
Status. Possible values: |
Get status
Get status details.
curl -X GET "https://billing.hostens.com/api/statuses/@id"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
]);
$resp = $client->get('/statuses/@id');
echo $resp->getBody();
req = requests.get('https://billing.hostens.com/api/statuses/@id')
print(req.json())
HTTP Request
GET /statuses/@id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Status id |
Get service ID from Order Number
curl -X GET "https://billing.hostens.com/api/service/order/@order_num" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/service/order/@order_num');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/service/order/@order_num', auth=auth)
print(req.json())
Example Response:
{
"account_id": 814
}
HTTP Request
GET /service/order/@order_num
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| order_num | int |
Order Number |
Cart
Most of API methods found here will require service @id, you can lookup your service ids with /service method
List product categories
Return a list of product categories.
curl -X GET "https://billing.hostens.com/api/category" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/category');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/category', auth=auth)
print(req.json())
Example Response:
{
"categories": [
{
"id": "10",
"name": "Hosting",
"description": "",
"slug": "hosting"
},
{
"id": "6",
"name": "Domains",
"description": "",
"slug": "domains"
},
{
"id": "16",
"name": "Dedicated",
"description": "",
"slug": "dedicated"
}
]
}
HTTP Request
GET /category
List products in category
Return a list of product available for purchase under requested category
curl -X GET "https://billing.hostens.com/api/category/@category_id/product" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/category/@category_id/product');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/category/@category_id/product', auth=auth)
print(req.json())
Example Response:
{
"products": [
{
"id": "333",
"type": "1",
"name": "Starter Hosting",
"stock": false,
"paytype": "Regular",
"description": "Disk:10GB
Memory:2GB
MySql:10 DB
Email:100 Users
",
"qty": "0",
"tags": [
],
"periods": [
{
"title": "m",
"value": "m",
"price": 9.99,
"setup": 0,
"selected": true
},
{
"title": "a",
"value": "a",
"price": 109.89,
"setup": 0,
"selected": false
},
{
"title": "b",
"value": "b",
"price": 199.8,
"setup": 0,
"selected": false
},
{
"title": "t",
"value": "t",
"price": 299.7,
"setup": 0,
"selected": false
}
]
},
(...)
]
}
HTTP Request
GET /category/@category_id/product
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| category_id | int |
Category ID |
Get product configuration details
Return product details with form configuration, addons and subproducts if available.
curl -X GET "https://billing.hostens.com/api/order/@product_id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/order/@product_id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/order/@product_id', auth=auth)
print(req.json())
Example Response:
{
"product": {
"id": "333",
"category_name": "Hosting",
"category_id": "49",
"name": "Starter Hosting",
"price": 9.99,
"recurring": "m",
"setup": 0,
"config": {
"product": [
{
"type": "select",
"title": "pickcycle",
"id": "cycle",
"name": "cycle",
"items": [
{
"title": "m",
"value": "m",
"price": 9.99,
"setup": 0,
"selected": true
},
{
"title": "a",
"value": "a",
"price": 109.89,
"setup": 0,
"selected": false
},
{
"title": "b",
"value": "b",
"price": 199.8,
"setup": 0,
"selected": false
},
{
"title": "t",
"value": "t",
"price": 299.7,
"setup": 0,
"selected": false
}
],
"value": "m",
"price": 9.99,
"setup": 0
},
{
"type": "input",
"title": "domain",
"id": "domain",
"name": "domain",
"value": null
}
],
"forms": [
{
"type": "select",
"title": "Disk Size",
"id": "1618",
"firstItemId": 10330,
"description": "",
"name": "custom[1618]",
"required": false,
"multiple": false,
"config": {
"conditionals": []
},
"value": [],
"textvalue": [],
"price": 0,
"recurring_price": 0,
"setup": 0,
"prorata_date": null,
"items": [
{
"title": "512MB",
"value": 1,
"id": 10330,
"price": 0,
"setup": 0,
"selected": false
},
{
"title": "1GB",
"value": 1,
"id": 10331,
"price": 0,
"setup": 0,
"selected": false
},
{
"title": "2GB",
"value": 1,
"id": 10332,
"price": 0,
"setup": 0,
"selected": false
}
]
},
(...)
],
"addons": [
{
"type": "subitem",
"title": "Cpanel2: Add Extra IP",
"id": "31",
"value": null,
"description": "Automatically adds IP address to account",
"config": [
{
"type": "checkbox",
"title": "add",
"name": "addon[31]",
"checked": false
},
{
"type": "select",
"title": "billingcycle",
"name": "addon_cycles[31]",
"items": [
{
"title": "m",
"value": "m",
"price": 5,
"setup": 0,
"selected": true
},
{
"title": "q",
"value": "q",
"price": 20,
"setup": 0,
"selected": false
},
{
"title": "a",
"value": "a",
"price": 50,
"setup": 0,
"selected": false
}
]
}
],
"price": 0,
"recurring_price": 0,
"setup": 0,
"prorata_date": null
},
(...)
],
"subproducts": []
},
"recurring_price": 9.99,
"prorata_date": null
}
}
HTTP Request
GET /order/@product_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | int |
Product ID |
Order new service
Create and submit new order for selected product.
To get available cycle and configuration options lookup product details
using GET /order/@product_id
curl -X POST "https://billing.hostens.com/api/order/@product_id" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"domain\": \"domainValue\",
\"cycle\": \"cycleValue\",
\"pay_method\": \"pay_methodValue\",
\"custom\": \"customValue\",
\"promocode\": \"promocodeValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/order/@product_id', [
'json' => [
"domain" => "domainValue",
"cycle" => "cycleValue",
"pay_method" => "pay_methodValue",
"custom" => "customValue",
"promocode" => "promocodeValue"
]
]);
echo $resp->getBody();
payload = {
'domain': "domainValue",
'cycle': "cycleValue",
'pay_method': "pay_methodValue",
'custom': "customValue",
'promocode': "promocodeValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/order/@product_id', json=payload, auth=auth)
print(req.json())
Example Response:
{
"order_num": 873340995,
"invoice_id": "308979",
"total": "9.99",
"items": {
"id": "10",
"type": "Hosting",
"name": "test.com",
"product_id": "3"
}
}
HTTP Request
POST /order/@product_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | int |
Product ID |
| domain | string |
Domain name, ie. example.com, may be optional |
| cycle | string |
Billing period symbol |
| pay_method | int |
Payment method ID |
| custom | array |
Additional options data available for sop products |
| promocode | string |
Promotion code |
Order multiple services
Create and submit new order for multiple services
Each item in the items array needs to include order type and parameters used
by one of the method listed below:
• POST /order/$product_id - use product for item type
• POST /domain/order - use domain for item type
• POST /certificate/order - use certificate for item type
curl -X POST "https://billing.hostens.com/api/order" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"pay_method\": 1,
\"items\": [
{
\"type\": \"product\",
\"product_id\": 1080,
\"domain\": \"hosting.com\",
\"cycle\": \"a\"
},
{
\"type\": \"certificate\",
\"product_id\": 840,
\"csr\": \"-----BEGIN CERTIFICATE REQUEST----- (...)\",
\"years\": 1,
\"approver_email\": \"admin@hosting.com\"
},
{
\"type\": \"domain\",
\"tld_id\": 6,
\"name\": \"hosting.com\",
\"action\": \"register\",
\"years\": 1
}
]
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/order', [
'json' => [
"pay_method" => 1,
"items" => [
[
"type" => "product",
"product_id" => 1080,
"domain" => "hosting.com",
"cycle" => "a"
],
[
"type" => "certificate",
"product_id" => 840,
"csr" => "-----BEGIN CERTIFICATE REQUEST----- (...)",
"years" => 1,
"approver_email" => "admin@hosting.com"
],
[
"type" => "domain",
"tld_id" => 6,
"name" => "hosting.com",
"action" => "register",
"years" => 1
]
]
]
]);
echo $resp->getBody();
payload = {
'pay_method': 1,
'items': [
{
'type': "product",
'product_id': 1080,
'domain': "hosting.com",
'cycle': "a"
},
{
'type': "certificate",
'product_id': 840,
'csr': "-----BEGIN CERTIFICATE REQUEST----- (...)",
'years': 1,
'approver_email': "admin@hosting.com"
},
{
'type': "domain",
'tld_id': 6,
'name': "hosting.com",
'action': "register",
'years': 1
}
]
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/order', json=payload, auth=auth)
print(req.json())
Example Response:
{
"order_num_list": [
179534732,
179534732,
179534732
],
"invoice_id": "503425",
"total": "94.40",
"items": [
{
"type": "Hosting",
"id": "1025",
"name": "hosting.com",
"product_id": "1080"
},
{
"type": "Hosting",
"id": "1026",
"name": "hosting.com",
"product_id": "840"
},
{
"type": "Domain Register",
"id": "354",
"name": "hosting.com",
"product_id": "6"
}
]
}
HTTP Request
POST /order
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| pay_method | int |
Payment method ID |
| items | array |
list with order items |
Get order quote
Calculate order cost and recuring prices for selected items.
Use the same parameters as for POST /order
curl -X POST "https://billing.hostens.com/api/quote" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"pay_method\": \"pay_methodValue\",
\"items\": \"itemsValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/quote', [
'json' => [
"pay_method" => "pay_methodValue",
"items" => "itemsValue"
]
]);
echo $resp->getBody();
payload = {
'pay_method': "pay_methodValue",
'items': "itemsValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/quote', json=payload, auth=auth)
print(req.json())
Example Response:
{
"summary": {
"subtotal": 72.2,
"total": 88.81,
"credit": 0,
"discount": 0,
"cost": 72.2,
"recurring": [
{
"title": "Annually",
"price": 81.18,
"value": "a"
},
{
"title": "Monthly",
"price": 1.48,
"value": "m"
}
],
"tax": [
{
"name": "VAT",
"tax": 16.61,
"value": 23
}
]
},
"items": [
{
"product": {
"id": 1080,
"category_name": "SSL",
"category_id": 69,
"name": "GeoTrust QuickSSL Premium",
"domain": "test.api",
(...)
},
"domains": {
(...)
},
"coupon": {},
"index": 0,
"valid": true,
"info": [],
"error": []
},
{
"product": {
"id": 840,
"category_name": "Proxmox",
"category_id": 19,
"name": "VPS",
"domain": "user.test.api",
(...)
},
"domains": {
(...)
},
"coupon": {},
"index": 1,
"valid": true,
"info": [],
"error": []
},
{
"product": null,
"domains": {
"hosting.com": {
"id": 6,
"index": 0,
"category_id": "6",
"category_name": "Domains",
"name": "hosting.com",
"tld": ".com",
"period": 1,
"price": "12.00",
(...)
}
},
"coupon": {},
"index": 2,
"valid": true,
"info": [],
"error": []
}
]
}
HTTP Request
POST /quote
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| pay_method | int |
Payment method ID |
| items | array |
list with items to order |
Get available VPS products
List all available virtual private server products
curl -X GET "https://billing.hostens.com/api/category/available/vps" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/category/available/vps');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/category/available/vps', auth=auth)
print(req.json())
Example Response:
[
{
"id": 0,
"name": "Linux",
"description": "- CPU: ...<\/li><\/ul>",
"prices": [
"aaa"
],
"components": [
"aaa"
],
"addons": [
"aaa"
],
"upgrades": [
"70",
"50",
"34"
]
}
]
HTTP Request
GET /category/available/vps
Order addon
Place order for addon to existing service
curl -X POST "https://billing.hostens.com/api/service/@id/addon" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"addon_id\": \"addon_idValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/service/@id/addon', [
'json' => [
"addon_id" => "addon_idValue"
]
]);
echo $resp->getBody();
payload = {
'addon_id': "addon_idValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/service/@id/addon', json=payload, auth=auth)
print(req.json())
Example Response:
{
"id": 98
}
HTTP Request
POST /service/@id/addon
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
| addon_id | int |
Addon id |
List all addons
List all ordered addons for existing service
curl -X GET "https://billing.hostens.com/api/service/@id/addon" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/service/@id/addon');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/service/@id/addon', auth=auth)
print(req.json())
Example Response:
{
"id": 93,
"name": "Additional IP",
"status": "Pending"
}
HTTP Request
GET /service/@id/addon
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
DNS
List DNS
Returns a list of all DNS
curl -X GET "https://billing.hostens.com/api/dns" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/dns');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/dns', auth=auth)
print(req.json())
Example Response:
{
"service_ids": [
"10",
"20"
],
"zones": [
{
"domain_id": "60",
"name": "booble.com",
"service_id": "10"
},
{
"domain_id": "61",
"name": "bgg12ooble.com",
"service_id": "20"
}
]
}
HTTP Request
GET /dns
Add DNS Zone
Creates a new DNS zone
curl -X POST "https://billing.hostens.com/api/service/@service_id/dns" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"name\": \"nameValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/service/@service_id/dns', [
'json' => [
"name" => "nameValue"
]
]);
echo $resp->getBody();
payload = {
'name': "nameValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/service/@service_id/dns', json=payload, auth=auth)
print(req.json())
Example Response:
{
"info": [
"Domain zone testzone.com was created successfully."
]
}
HTTP Request
POST /service/@service_id/dns
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| service_id | int |
Service ID |
| name | string |
Zone name (example: testzone.com) |
Get DNS details
Returns details of the DNS zone
curl -X GET "https://billing.hostens.com/api/service/@service_id/dns/@zone_id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/service/@service_id/dns/@zone_id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/service/@service_id/dns/@zone_id', auth=auth)
print(req.json())
Example Response:
{
"service_id": 10,
"name": "booble.com",
"records": [
{
"id":"10",
"name":"qwerty",
"ttl":1800,
"priority":0,
"content":"127.0.0.1"
"type":"A"
},
{
"id":"11",
"name":"qwerty",
"ttl":1800,
"priority":0,
"content":"ns1.qwerty.com"
"type":"NS"
}
]
}
HTTP Request
GET /service/@service_id/dns/@zone_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| service_id | int |
Service ID |
| zone_id | int |
Zone ID |
Remove DNS zone
Deletes the selected DNS zone
curl -X DELETE "https://billing.hostens.com/api/service/@service_id/dns/@zone_id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->delete('/service/@service_id/dns/@zone_id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.delete('https://billing.hostens.com/api/service/@service_id/dns/@zone_id', auth=auth)
print(req.json())
Example Response:
{
"info": [
"Domain zone testzone.com was deleted successfully."
]
}
HTTP Request
DELETE /service/@service_id/dns/@zone_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| service_id | int |
Service ID |
| zone_id | int |
Zone ID |
Add DNS Record
Creates a new record in the DNS zone
curl -X POST "https://billing.hostens.com/api/service/@service_id/dns/@zone_id/records" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"name\": \"nameValue\",
\"ttl\": \"ttlValue\",
\"priority\": \"priorityValue\",
\"type\": \"typeValue\",
\"content\": \"contentValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/service/@service_id/dns/@zone_id/records', [
'json' => [
"name" => "nameValue",
"ttl" => "ttlValue",
"priority" => "priorityValue",
"type" => "typeValue",
"content" => "contentValue"
]
]);
echo $resp->getBody();
payload = {
'name': "nameValue",
'ttl': "ttlValue",
'priority': "priorityValue",
'type': "typeValue",
'content': "contentValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/service/@service_id/dns/@zone_id/records', json=payload, auth=auth)
print(req.json())
Example Response:
{
"info": [
"Domain zone testzone.com was created successfully."
]
}
HTTP Request
POST /service/@service_id/dns/@zone_id/records
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| service_id | int |
Service ID |
| zone_id | int |
Zone ID |
| name | string |
Record name |
| ttl | int |
Record ttl (example: 3600) |
| priority | int |
Priority of the record |
| type | string |
Record type (example: A) |
| content | string |
Contents of the record (example: 192.168.1.2) |
Edit DNS Record
Edits the selected DNS zone record
curl -X PUT "https://billing.hostens.com/api/service/@service_id/dns/@zone_id/records/@record_id" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"name\": \"nameValue\",
\"ttl\": \"ttlValue\",
\"priority\": \"priorityValue\",
\"type\": \"typeValue\",
\"content\": \"contentValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->put('/service/@service_id/dns/@zone_id/records/@record_id', [
'json' => [
"name" => "nameValue",
"ttl" => "ttlValue",
"priority" => "priorityValue",
"type" => "typeValue",
"content" => "contentValue"
]
]);
echo $resp->getBody();
payload = {
'name': "nameValue",
'ttl': "ttlValue",
'priority': "priorityValue",
'type': "typeValue",
'content': "contentValue"
}
auth=('username', 'password')
req = requests.put('https://billing.hostens.com/api/service/@service_id/dns/@zone_id/records/@record_id', json=payload, auth=auth)
print(req.json())
Example Response:
{
"record": {
"id": "55",
"type": "A",
"ttl": "3600",
"name": "test",
"priority": 0,
"content": "192.168.1.2"
},
"info": [
"The record was updated successfully."
]
}
HTTP Request
PUT /service/@service_id/dns/@zone_id/records/@record_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| service_id | int |
Service ID |
| zone_id | int |
Zone ID |
| record_id | int |
Record ID |
| name | string |
Record name |
| ttl | int |
Record ttl (example: 3600) |
| priority | int |
Priority of the record |
| type | string |
Record type (example: A) |
| content | string |
Contents of the record (example: 192.168.1.2) |
Remove DNS Record
Removes the selected DNS zone record
curl -X DELETE "https://billing.hostens.com/api/service/@service_id/dns/@zone_id/records/@record_id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->delete('/service/@service_id/dns/@zone_id/records/@record_id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.delete('https://billing.hostens.com/api/service/@service_id/dns/@zone_id/records/@record_id', auth=auth)
print(req.json())
HTTP Request
DELETE /service/@service_id/dns/@zone_id/records/@record_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| service_id | int |
Service ID |
| zone_id | int |
Zone ID |
| record_id | int |
Record ID |
Server Management
Server management API lets you retrieve your active server information and manage them.
All management tasks are asynchronous. This means called method will only initiate task and will return result of task initiation.
If task initiation was unsuccessfull, error message will be returned. Task id is used to query Task Result method
to retrieve task result. For more info see documentation of Task Result method.
For example to reboot server, you must initiate task by calling POST /server/@id/reboot.
If task initiated successfully, you'll receive task_id parameter, which must be provided in
GET /server/@server_id/task/@task_id call, to receive task results.
You can run one task per server at a time.
List All Servers
Lists all active servers. Results includes only the brief information about the server.
Call is synchronous - result returned immediately.
curl -X GET "https://billing.hostens.com/api/server" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/server');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/server', auth=auth)
print(req.json())
Example Response:
{
"server_id": 113,
"domain": "server.domain.name",
"ip": "1.2.3.4",
"date_created": "2017-01-31",
"synch_date": "2017-01-31 15:35:00",
"label": "Data Server",
"type": "OpenVZ"
}
HTTP Request
GET /server
Server Details
Particular server details: configuration, installed OS, resource usage and etc.
Call is synchronous - result returned immediately.
curl -X GET "https://billing.hostens.com/api/server/@server_id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/server/@server_id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/server/@server_id', auth=auth)
print(req.json())
Example Response:
{
"synch_date": "2018-07-18T14:04:34+00:00",
"package_id": 13,
"domain": "server.domain.name",
"label": "Data Server",
"status": "Active",
"cpu_frequency": 1056,
"cpu_cores": 2,
"ram_limit": 216,
"ram_used": 36,
"disk_limit": 18222,
"disk_usage": 176,
"bw_limit": 2050,
"bw_in": 84,
"bw_out": 598,
"os": "ubuntu-16.04-x86_64",
"ip": "123.123.123.123",
"additional_ip": [
"124.124.124.124",
"125.125.125.125"
],
"dns_servers": null,
"components": [
{
"id": 123,
"name": "Daily and weekly backups",
"selected": false
}
],
"active_task": null,
"last_tasks": null
}
HTTP Request
GET /server/@server_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
Task Result
Returns task result by given task ID, all dates are in ISO 8601 format:
-
activateddate of task initiation -
assigneddate of task assignation for execution (empty string for unassigned task) -
completeddate of task completion (empty string for unassigned and / or running task) -
resultsis task completion result (empty string for unassigned and / or running task)
Call is synchronous - result returned immediately.
curl -X GET "https://billing.hostens.com/api/server/@server_id/task/@task_id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/server/@server_id/task/@task_id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/server/@server_id/task/@task_id', auth=auth)
print(req.json())
Example Response:
{
"name": "server_reboot",
"activated": "2018-05-31T10:25:24+00:00",
"assigned": "2018-05-31T10:26:24+00:00",
"completed": "2018-05-31T10:27:24+00:00",
"results": "VM rebooted successfully"
}
HTTP Request
GET /server/@server_id/task/@task_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
| task_id | int |
Task ID |
Reboot
Call is asynchronous - task ID is returned.
curl -X POST "https://billing.hostens.com/api/server/@server_id/reboot" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/server/@server_id/reboot');
echo $resp->getBody();
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/server/@server_id/reboot', auth=auth)
print(req.json())
Example Response:
{
"task_id": 77995
}
HTTP Request
POST /server/@server_id/reboot
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
Reinstall
Available OS'es can be obtained with GET /server/@server_id/oses call.
All data in the server will be lost! All of backups of your server will be deleted from our storages!
Call is asynchronous - task ID is returned.
curl -X POST "https://billing.hostens.com/api/server/@server_id/reinstall" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"os\": \"osValue\",
\"script\": \"scriptValue\",
\"ssh_key\": \"ssh_keyValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/server/@server_id/reinstall', [
'json' => [
"os" => "osValue",
"script" => "scriptValue",
"ssh_key" => "ssh_keyValue"
]
]);
echo $resp->getBody();
payload = {
'os': "osValue",
'script': "scriptValue",
'ssh_key': "ssh_keyValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/server/@server_id/reinstall', json=payload, auth=auth)
print(req.json())
Example Response:
{
"task_id": 39696
}
HTTP Request
POST /server/@server_id/reinstall
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
| os | string |
Operating System (required) |
| script | int |
Init Script ID (optional) |
| ssh_key | string |
SSH Key (optional) |
Reset Password
Resets privileged user password
Call is asynchronous - task ID is returned.
curl -X POST "https://billing.hostens.com/api/server/@server_id/resetpassword" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/server/@server_id/resetpassword');
echo $resp->getBody();
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/server/@server_id/resetpassword', auth=auth)
print(req.json())
Example Response:
{
"task_id": 138944
}
HTTP Request
POST /server/@server_id/resetpassword
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
Launch Web Console
Web Console should be used for emergency access only!
Call is asynchronous - task ID is returned.
curl -X POST "https://billing.hostens.com/api/server/@server_id/webconsole" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"timeout\": \"timeoutValue\",
\"whitelabel\": \"whitelabelValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/server/@server_id/webconsole', [
'json' => [
"timeout" => "timeoutValue",
"whitelabel" => "whitelabelValue"
]
]);
echo $resp->getBody();
payload = {
'timeout': "timeoutValue",
'whitelabel': "whitelabelValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/server/@server_id/webconsole', json=payload, auth=auth)
print(req.json())
Example Response:
{
"task_id": 41222
}
HTTP Request
POST /server/@server_id/webconsole
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
| timeout | string |
Timeout in hours (required, valid values: '1h', '3h', '6h', '12h', '24h') |
| whitelabel | bool |
Should result return white-labeled VNC host (required, valid values: 'true', 'false') |
Change Hostname
Changes the hostname of your server. Hostname must pointed to your server main IP address.
Note: Full DNS record propagation can take up to 48 hours.
Call is asynchronous - task ID is returned.
curl -X POST "https://billing.hostens.com/api/server/@server_id/rename" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"hostname\": \"hostnameValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/server/@server_id/rename', [
'json' => [
"hostname" => "hostnameValue"
]
]);
echo $resp->getBody();
payload = {
'hostname': "hostnameValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/server/@server_id/rename', json=payload, auth=auth)
print(req.json())
Example Response:
{
"task_id": 67845
}
HTTP Request
POST /server/@server_id/rename
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
| hostname | string |
New hostname (required, must be pointed to server IP) |
Change PTR Record
Changes PTR record for the additional IP (if server has more than one IPv4 address).
Call is asynchronous - task ID is returned.
curl -X POST "https://billing.hostens.com/api/server/@server_id/changeptr" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"ip_address\": \"ip_addressValue\",
\"hostname\": \"hostnameValue\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/server/@server_id/changeptr', [
'json' => [
"ip_address" => "ip_addressValue",
"hostname" => "hostnameValue"
]
]);
echo $resp->getBody();
payload = {
'ip_address': "ip_addressValue",
'hostname': "hostnameValue"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/server/@server_id/changeptr', json=payload, auth=auth)
print(req.json())
Example Response:
{
"task_id": 104886
}
HTTP Request
POST /server/@server_id/changeptr
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
| ip_address | string |
IP Address to change PTR (required) |
| hostname | string |
Hostname (required) |
Flush IPTables / Firewall
Restores to defaults your server`s firewall settings.
Call is asynchronous - task ID is returned.
curl -X POST "https://billing.hostens.com/api/server/@server_id/flushfirewall" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/server/@server_id/flushfirewall');
echo $resp->getBody();
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/server/@server_id/flushfirewall', auth=auth)
print(req.json())
Example Response:
{
"task_id": 82838
}
HTTP Request
POST /server/@server_id/flushfirewall
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
Change DNS Servers
Changes the DNS servers for your server.
At least 1 DNS servers muste be provided.
Call is asynchronous - task ID is returned.
curl -X POST "https://billing.hostens.com/api/server/@server_id/changedns" \
-u user:pass \
-H "Content-Type: application/json" \
-d "{
\"ns1\": \"ns1Value\",
\"ns2\": \"ns2Value\",
\"ns3\": \"ns3Value\",
\"ns4\": \"ns4Value\"
}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->post('/server/@server_id/changedns', [
'json' => [
"ns1" => "ns1Value",
"ns2" => "ns2Value",
"ns3" => "ns3Value",
"ns4" => "ns4Value"
]
]);
echo $resp->getBody();
payload = {
'ns1': "ns1Value",
'ns2': "ns2Value",
'ns3': "ns3Value",
'ns4': "ns4Value"
}
auth=('username', 'password')
req = requests.post('https://billing.hostens.com/api/server/@server_id/changedns', json=payload, auth=auth)
print(req.json())
Example Response:
{
"task_id": 27180
}
HTTP Request
POST /server/@server_id/changedns
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
| ns1 | string |
Nameserver 1 IP address (required) |
| ns2 | string |
Nameserver 2 IP address (recommended) |
| ns3 | string |
Nameserver 3 IP address (optional) |
| ns4 | string |
Nameserver 4 IP address (optional) |
Available OS List
List of available OS templates for a server.
Call is synchronous - result returned immediately.
curl -X GET "https://billing.hostens.com/api/server/@server_id/oses" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/server/@server_id/oses');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/server/@server_id/oses', auth=auth)
print(req.json())
Example Response:
[
{
"os": "centos-7-x86_64",
"title": "Centos 7"
}
]
HTTP Request
GET /server/@server_id/oses
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
Get additional IPs
List of additional IPs
Call is synchronous - result returned immediately.
curl -X GET "https://billing.hostens.com/api/server/@server_id/ips" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/server/@server_id/ips');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/server/@server_id/ips', auth=auth)
print(req.json())
Example Response:
[
{
"ips": [
"123.123.123.123",
"124.124.124.124"
]
}
]
HTTP Request
GET /server/@server_id/ips
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
Get Usage Graphs
Image link is valid only for short period of time, around 5-10 minutes.
Images shows the graphics of the main resource usage (Daily, Weekly, Monthly..)
Call is synchronous - result returned immediately.
curl -X GET "https://billing.hostens.com/api/server/@server_id/graphs/@width" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/server/@server_id/graphs/@width');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/server/@server_id/graphs/@width', auth=auth)
print(req.json())
Example Response:
[
{
"type": "cpu_daily",
"url": "\/\/...\/graph.php?...VrBFovT0mOE0OZFwNrUf"
}
]
HTTP Request
GET /server/@server_id/graphs/@width
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
| width | int |
Image Width (min 200px, max 768px) |
Get Usage History
Displays the bandwidth usage of a server.
Call is synchronous - result returned immediately.
curl -X GET "https://billing.hostens.com/api/server/@server_id/history" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/server/@server_id/history');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/server/@server_id/history', auth=auth)
print(req.json())
Example Response:
[
{
"year": 0,
"month": 0,
"bw_in": 19691,
"bw_out": 54435,
"quota_usage": 5960,
"quota_limit": 46566,
"inode_usage": 74921,
"inode_limit": 51351
}
]
HTTP Request
GET /server/@server_id/history
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| server_id | int |
Server ID |
Init Script Management
Get available init scripts
Script content is not included
curl -X GET "https://billing.hostens.com/api/scripts" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/scripts');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/scripts', auth=auth)
print(req.json())
Example Response:
{
"id": 738,
"name": "My Init Script",
"syntax": "python"
}
HTTP Request
GET /scripts
Get init script by ID
Script content is included
curl -X GET "https://billing.hostens.com/api/scripts/@id" \
-u user:pass
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://billing.hostens.com/api',
'auth' => ['username', 'password']
]);
$resp = $client->get('/scripts/@id');
echo $resp->getBody();
auth=('username', 'password')
req = requests.get('https://billing.hostens.com/api/scripts/@id', auth=auth)
print(req.json())
Example Response:
{
"id": 1076,
"name": "My Init Script",
"syntax": "python",
"content": "import os..."
}
HTTP Request
GET /scripts/@id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Init Script ID |