API
Here is a brief documentation on how the Cloudnet API works. This is not a complete documentation, as only a part of the API is documented.
Connecting
The API is REST with json. The stated goal is that ease of communication with the API. GET, POST, PUT and PATCH is utilized depending on the call. All connections are made over https. The URL to connect to is:
https://api.cloudnet.se/api/v2
Authentication
Each user has an unique API-key. To get your API-key it is necessary to contact support. The key is stated as an extra header in the calls. Below is an example using Curl:
$ curl --header "api_key: <api-nyckel>" https://api.cloudnet.se/api/v2/instance/
[
{
"url": "https://api.cloudnet.se/api/v2/instance/c1234/",
"name": "c1234",
"hostname": "",
"description": "Webshop produktion",
"instance_size": "Large",
"instance_type": "Magento",
"ip": "121.226.229.12",
"ipv6": "2b53:7f02::f05c:ae45:feae:4334"
},
{
"url": "https://api.cloudnet.se/api/v2/instance/c5555/",
"name": "c5555",
"hostname": ""
"description": "Webshop stage",
"instance_size": "Medium",
"instance_type": "Magento",
"ip": "121.45.221.32",
"ipv6": "2b53:7f02::f05c:ae45:feae:456e"
}
]
Endpoints
Below is a list of all the endpoints with parameters.
/instance/
Returns a list with all the servers you have access to, either as owner or technical contact.
Method: GET
[{
url (url): URL to server object,
name (string): Name of server,
hostname (string): Hostname of server. If left blank, name is used.,
description (string): Description of server,
instance_size (integer),
instance_type (string),
ip (string),
ipv6 (string)
}]
/instance/{name}/
Returns more detailed information about a server.
Method: GET
{
url (url): URL to user object,
applications (string),
cores (string),
customers (array)
[{
url (string),
name (string): Name of customer,
contact_name (string): Contact reference name
}],
description (string): Description of server,
disks (array)
[{
mountpoint (string): Mountpoint, i.e. /mnt/persist,
name (string): Name of disk partition,
path (string): Path to device to attach, i.e. /dev/vg00/cloudnet-3000,
hd (integer): Harddisk
}],
domain (string): Domainname for server (only used in rare cases).,
hostname (string): Hostname of server. If left blank, name is used.,
instance_type (string),
instance_size (integer),
invoice_contact (array)
{
url (url): URL to customer object,
name (string): Name of customer,
contact_name (string): Contact reference name
},
ip (string),
ipv6 (string),
memory (string),
name (string),
networks (array)
[{
interface (choice) = ['lan' or 'dmz' or 'wan' or 'eth0' or 'eth1' or 'eth2' or 'eth0:1' or 'eth0:2' or 'eth0:3' or 'venet0']: Local interface,
ip (string): IP address on interface,
ipv6 (string): IPv6 address on interface.,
gateway (string): Default gateway,
netmask (string): Netmask
}],
technical_contact (string): Name / company that's technical contact
}
/instance/{name}
Updates the “description”, “hostname” and “technical contact” for a server. Remember that it is important that Cloudnet understands what the server is used for, as well.
Method: PATCH
{
name (string): path string (required)
description (string): Description of server
hostname (string): Hostname of server. If left blank, name is used.
technical_contact (string): Name / company that's technical contact
}
/instance/{name}/sshkeys/
Returns a list of SSH-keys associated with and available to a server.
Method: GET
{
name (string): Name of server,
description (string): Description of server,
ssh_keys (array): Keys that are assigned to server
[{
"company" (string): Name of company user work on,
"fingerprint" (string): Fingerprint of the SSH-key,
"id" (int): Id of the key, for reference,
"name" (string): Key comment,
"owner" (string): User that owns the key,
"pub_key" (string): The public part of the key,
"sticky" (bool): If the key is sticky or not
}]
ssh_keys_available (array): Keys that are available but not assigned
[{
"company" (string): Name of company user work on,
"fingerprint" (string): Fingerprint of the SSH-key,
"id" (int): Id of the key, for reference,
"name" (string): Key comment,
"owner" (string): User that owns the key,
"pub_key" (string): The public part of the key,
"sticky" (bool): If the key is sticky or not
}]
}
/instance/{name}/deploykeys/
Returns a list of SSH-keys associated with and available to a server. These keys are so-called “deploy-keys” and are not connected to an individual person.
Method: GET
{
name (string): Name of server,
description (string): Description of server,
keys (array): Keys that are assigned to server
[{
"company" (string): Name of company user work on,
"fingerprint" (string): Fingerprint of the SSH-key,
"id" (int): Id of the key, for reference,
"name" (string): Key comment,
"pub_key" (string): The public part of the key,
}]
}
/instance/{name}/users/
Returns a list of users associated with and available to a server.
Method: GET
{
name (string): Name of server,
description (string): Description of server,
users (array): Users that are assigned to server
[{
"customer" (string): Name of company user work on,
"avatar" (string): URL to avatar,
"id" (int): Id of the key, for reference,
"name" (string): Key comment,
"email" (string): Email address to user,
"phone" (string): Phone number to user,
"sticky" (bool): If user is sticky or not,
"sticky_notify" (bool): If user is sticky notify or not,
}],
users_available (array): Available but not assigned users,
[{
"customer" (string): Name of company user work on,
"avatar" (string): URL to avatar,
"id" (int): Id of the key, for reference,
"name" (string): Key comment,
"email" (string): Email address to user,
"phone" (string): Phone number to user,
"sticky" (bool): If user is sticky or not,
"sticky_notify" (bool): If user is sticky notify or not,
}],
}
/instance/user/
Returns a list of users.
Method: GET
{
[{
"customer" (string): Name of company user work on,
"avatar" (string): URL to avatar,
"id" (int): Id of the key, for reference,
"name" (string): Key comment,
"email" (string): Email address to user,
"phone" (string): Phone number to user,
"sticky" (bool): If user is sticky or not,
"sticky_notify" (bool): If user is sticky notify or not,
}]
/instance/user/{id}/
Returns detailed information on a user.
Method: GET
{
url (url): URL to this object,
id (integer),
name (string),
email (string),
phone (string): Phonenumber,
customer (customer),
{
url (string): URL to customer object,
name (string): Name of customer,
contact_name (string): Contact reference name
}
ssh_keys (array),
[{
url (url),
id (integer),
name (string): Name of SSH key,
pub_key (string): The public part of key,
fingerprint (string): Key fingerprint,
}]
sticky (boolean): Set if, this user will be always available on instances owned by its customer, and all his SSH keys,
sticky_notify (boolean): Set if, this user will always be notified on problems on instances owned by its customer,
instances (array),
{
"access" (bool): If user have access to this server,
"description" (string): Description of server,
"invoice_contact": (customer) {
"contact_name" (string): Contact reference name,
"name" (string): Name of customer
"url" (url): URL to customer object
},
"name" (string): Name of server,
"notify" (bool): If user is notified on trouble
"url"n (url):URL to server object
},
totp_url (string): URL to TOTP token, if used
/domain/
Returns a list of domains associated to you.
Method: GET
{
CPDomainSerializer {
url (string),
name (string): Domain name. I.e. example.com,
customer (array),
[{
url (url): URL to customer object,
name (string): Name of customer,
contact_name (string): Contact reference name
}]
whois_registrar (string): Registrar,
whois_created (string): Date when domain was registerd,
whois_expire (string): Date when domain expire,
invoice (customer)
{
url (url): URL to customer object,
name (string): Name of customer,
contact_name (string): Contact reference name
}
}
/domain/{name}/
Returns a detailed list on a domain and its content.
Method: GET
{
url (string),
name (string): Domain name. I.e. example.com,
customer (array),
[{
url (url): URL to customer object,
name (string): Name of customer,
contact_name (string): Contact reference name
}]
whois_registrar (string): Registrar,
whois_created (string): Date when domain was registerd,
whois_expire (string): Date when domain expire,
invoice (customer)
{
url (url): URL to customer object,
name (string): Name of customer,
contact_name (string): Contact reference name
}
records (array): All records for domain
[{
domain (string) Domain name,
name (string): Actual name of a record. Must not end in a '.' and be fully qualified - it is not relative to the name of the domain!,
type (choice) = ['A' or 'AAAA' or 'CNAME' or 'MX' or 'NS' or 'PTR' or 'SPF' or 'SRV' or 'TXT']: Record qtype,
content (string): The 'right hand side' of a DNS record. For an A record, this is the IP address,
ttl (integer): TTL of this record, in seconds,
prio (integer): For MX records, this should be the priority of the mail exchanger specified
}]
}
/certificate/
Return a list of SSL-certificates associated to you.
Method: GET
{
domain (string): Domain for cert. Domain name must be IDN encoded.,
invoice (customer),
{
url (string),
name (string): Name of customer,
contact_name (string): Contact reference name
}
expire (string): Time when cert expires. This field is auto-calculated
}
Help
If you have questions or are in need of assistance, please mail [email protected]. You can also call us during office hours at +46-8-123 500 50.