JSON REST API




Order request




{
        "action": "order_create"

        ,"items": [
                {
                        "name": "My testserver 1"
                        , "product":
                        {
                                "name": "VPS"
                                , "options":
                                {
                                        "quantity_ram_gb": 0.5
                                        , "quantity_cpu": 9
                                        , "quantity_storage_gb": 25
                                        , "os": "Debian"
                                        , "os_version": "10.4"
                                        , "antiaffinity": "optional number"
                                        , "firewall_id": "optional firewall id to become a member of"

                                        , "features":
                                        {
                                             "ipv4": 1

                                             , "sshd":
                                             {
                                                , "authorized_keys": "ssh-rsa ......"
                                                , "ip_allow": "fec0:aaa:1:2::ff,192.168.0.0/24"  (required)
                                                , "public_ports_allow": "80,443,12000:12010"
                                               
                                             }

                                        }
                                }
                        }
               }
        ]
        , "reference": "Optional order reference"


}



Return data is HTTP 2xx JSON with created order id. HTTP response codes other than 2xx is an error
If your profile do not have enough credit, you might get a response asking for payment. The invoice is already created if so.

Antiaffiniy - if another VPS have the same number, the order cannot be placed on the same host as the existing VPS
Firewall_id - add the VPS as a member of this firewall group


Order response example


{"order_id": 73, "status": 200, "message": "Order is being processed"}


Order status


{
        "action": "order_status"
        ,"order_id": NNNN
}

Order status response example


{
  "order_id": 73
  , "status": 200
  , "message": "Order is being processed"

  , "order_items": [
     {
         "id": 1293
          , "status": 200
          , "name": "VPS"
          , "reference":"My testserver 1"
          , "message": "Order is being processed"
     }
   ]
}


Order list

Lists all orders

{
        "action": "order_list"
}

Order cancel


Cancel the entire order

{
        "action": "order_cancel"
        ,"order_id": NNNN
}

Cancel an item of the order

{
        "action": "order_cancel"
        ,"order_id": NNNN
        ,"order_item_id": NNNN
}

The order items will not be renewed and will be cancelled after end period.
Response is an empty 200 OK, or 404 not found for not found.



Server list

Lists all servers

{
        "action": "server_list"
        ,"order_item_id": 0  // 0 or blank for all servers
}

Server list response example


{
         "servers": [
            {
                   "id": NNNN
                   , "name": "my.server.com"
                   , "cpu": 1
                   , "memory": 512
                   , "is_running": 1
                   , "customer_id": NNNN
                   , "order_item_id": NNNN
                   , "networks": [
                       {
                                      "id": NNNN
                                      , "ifindex": 0
                                      , "name": "Segmentname1"
                                      , "ipv4": "127.0.0.2"
                                      , "ipv6": "fec0::fec0"
                        }
                    ]
                   , "storages": [
                       {
                                      "id": NNN
                                      , "lun": 0
                                      , "name": "NVM SSD"
                                      , "size": 20000
                       }
                   ]
             }
         ]
}



Status codes


Customer_id refers to your my.klikk profile. A profile can have many billing addresses. In some setups it is also possible to have multiple profiles.