snabbare Created with Sketch.
cloud Created with Sketch.
Fill 2 Copy 5 Created with Sketch.
cloud Created with Sketch.

Dokumentation API

API

Här finns en snabbdokumentation över hur API hos Cloudnet fungerar. Dokumentationen är inte komplett utan bara en delmängd.

Anslutning

API:et är REST med json. Meningen är att det ska vara enkelt att prata med. Både GET, POST, PUT och PATCH används beroende på olika anrop. Alla anrop sker över https. Den URL som ska anropas är:

https://api.cloudnet.se/api/v2

Autentisering

Varje användare har en unik API-nyckel. För att få din nyckel så måste du kontakta suppoer. När du har nyckeln så anger du den som en extra ”Header” i anropen. Se exemplet nedan med 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"
  }
]

Endspoints

Här är en lista med alla endpoints med parametrar.

/instance/

Returnerar en lista med alla servrar du har tillgång till, antingen som ägare eller teknisk kontakt.

Metod: 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}/

Returnerar mer detaljerad information om en server.

Metod: 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}

Uppdaterar ”description”, ”hostname” och ”technical_contact” för en server. Tänk på att det är viktigt att även Cloudnet förstår vad servern används till.

Metod: 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/

Returnerar en lista på SSH-nycklar knutna och tillgängliga för en server.

Metod: 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/

Returnerar en lista på SSH-nycklar knutna och tillgängliga för en server. Nycklarna är s.k. deploykeys som inte är kopplade till en person.

Metod: 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/

Returnerar en lista på användare som är knutna och tillgängliga för en server.

Metod: 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/

Returnerar en lista på användare.

Metod: 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}/

Returnerar detaljerad information om en användare.

Metod: 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/

Returnerar en lista på domäner som är knuten till dig.

Metod: 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}/

Returnerar en detaljerad lista på en domän och dess innehåll.

Metod: 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/

Returnerar en lista på SSL-certifikat som är knuten till dig.

Metod: 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
}

 

HJÄLP

Om du har frågor eller behöver hjälp, posta ditt ärende på support@cloudnet.se. Du kan även ringa oss under kontorstid på 08-123 500 50.