API-dokumentasjon

Gigahost API-dokumentasjon for kunder. Integrer servere og tjenester direkte i eget panel eller eget system.

Nåværende API-versjon: 0
Base-URL: https://api.gigahost.no/api/v0

Autentisering

For å kommunisere med vårt API må du autentisere deg. For å gjøre dette, bruk /authenticate endepunktet.

Legg til den mottatte token i din header: Authorization: Bearer {token}

JSON

Det er forventet at all PUT/POST-forespørsler er json-kodet.

/authenticate

POST
/authenticate
Authenticate with API and receive Authorization Token.

Returns necessary token to authenticate with the API.

Parameters
username (string)
password (string)

Optional parameters
code (numeric) - If you have 2FA enabled

Example return data

{ "success":true, "meta": { "status": 200, "status_message": "200 OK" }, "data": { "token":"xxxxxxxx", "token_expire": "unixtimestamp", "customer_id": "xxxxxx" } }

/server

GET
/servers
Get a list of your servers

Returns a list of all your servers

Parameters
{none}

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":[ { "srv_id":"111", "srv_tag":"0", "product_id":"0", "cust_id":"111", "node_id":"0", "pmx_id":"111", "os_id":"111", "nic_id":"111", "iso_id":"0", "bwpool_id":"0", "srv_name":"srv111.gigahost.no", "srv_status":true, "srv_status_rescue":false, "srv_status_install":false, "srv_status_snapshot":false, "srv_status_mount":false, "srv_status_method":"icmp", "srv_status_reboot":"0", "srv_label":"srv111.gigahost.no", "srv_manufacturer":"", "srv_model":"", "srv_motherboard":"", "srv_date_created":"1530609706", "srv_vps_type":"kvm", "srv_hostname":"srv111.gigahost.no", "srv_bw":"1000", "srv_feature_reinstall":true, "srv_feature_mgmt":true, "srv_feature_preconf":"0", "srv_mgmt_type":"kvm", "srv_formfactor":"", "srv_cores":"2", "srv_ram":"2", "srv_ram_type":"", "srv_ram_sticks":"0", "srv_ram_vendor":"", "srv_vnc_port":"0", "srv_vnc_password":"", "srv_vnc_token":"", "srv_suspended":false, "srv_custom_partition":"1", "srv_new":false, "srv_location":"DC2", "srv_type":"vps", "srv_primary_ip":"185.181.63.xx", "os":{ "os_id":"72", "os_name":"Ubuntu 18.04 LTS 64-bit", "os_release":"ubuntu", "os_dedicated_only":"0", "os_minram":"0", "os_custom_partition":"1", "os_single_disk_only":"1" }, "ips":[ { "ip_id":"7795", "sub_id":"405", "ip_v4v6":"ipv4", "ip_address":"185.181.63.xx", "ip_reverse":"static.185.181.63.xx.customers.gigahost.no", "ip_traffic_sum":"0", "ip_pkts_sum":"0", "ip_nullroute":"0", "ip_routed_to":"0", "ip_type":"primary", "ip_netmask":"255.255.255.0", "ip_gateway":"185.181.63.1" }, { "ip_id":"7538", "sub_id":"404", "ip_v4v6":"ipv4", "ip_address":"185.181.62.xx", "ip_reverse":"static.185.181.62.xx.gigahost.no", "ip_traffic_sum":"0", "ip_pkts_sum":"0", "ip_nullroute":"0", "ip_routed_to":"7795", "ip_type":"extra", "ip_netmask":"255.255.255.0", "ip_gateway":"185.181.62.1" } ] "cancelled":null } }
GET
/servers/{id}
Get data for server

Returns server data

Parameters
server_id (numeric - inurl)

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":[ { "srv_id":"3523", "srv_tag":"0", "product_id":"0", "cust_id":"19998", "node_id":"0", "pmx_id":"4", "os_id":"72", "nic_id":"1422", "iso_id":"0", "bwpool_id":"0", "srv_name":"srv3523.gigahost.no", "srv_status":true, "srv_status_rescue":false, "srv_status_install":false, "srv_status_snapshot":false, "srv_status_mount":false, "srv_label":"srv3523.gigahost.no", "srv_manufacturer":"", "srv_model":"", "srv_motherboard":"", "srv_date_created":"1530609706", "srv_vps_type":"kvm", "srv_hostname":"srv3523.gigahost.no", "srv_bw":"1000", "srv_feature_reinstall":true, "srv_feature_mgmt":true, "srv_feature_preconf":false, "srv_mgmt_type":"kvm", "srv_formfactor":"", "srv_cores":"2", "srv_ram":"2", "srv_ram_type":"", "srv_ram_sticks":"0", "srv_ram_vendor":"", "srv_vnc_port":"0", "srv_vnc_password":"", "srv_vnc_token":"", "srv_vmware_id":"0", "srv_suspended":false, "srv_deleted":"0", "srv_deleted_date":"0", "srv_bw_notice":"0", "srv_migration_state":"2", "srv_custom_partition":"1", "srv_new":false, "srv_location":"DC2", "srv_type":"vps", "ipmi_session":null, "os":{ "os_id":"72", "os_name":"Ubuntu 18.04 LTS 64-bit", "os_release":"ubuntu", "os_dedicated_only":"0", "os_minram":"0", "os_custom_partition":"1", "os_single_disk_only":"1", "dist_logo":"/images/os/ubuntu.png" }, "cpus":[ ], "hdds":[ { "hdd_id":"1622", "srv_id":"3523", "datastore_id":"0", "hdd_manufacturer":"Proxmox", "hdd_model":"", "hdd_type":"SSD", "hdd_size":"20", "hdd_space_used":"0", "hdd_serial_number":"" } ], "ips":[ { "ip_id":"7795", "sub_id":"405", "ip_v4v6":"ipv4", "ip_address":"185.181.63.24", "ip_reverse":"static.185.181.63.24.customers.gigahost.no", "ip_traffic_sum":"0", "ip_pkts_sum":"0", "ip_nullroute":"0", "ip_routed_to":"0", "ip_type":"primary", "ip_netmask":"255.255.255.0", "ip_gateway":"185.181.63.1" }, { "ip_id":"7538", "sub_id":"404", "ip_v4v6":"ipv4", "ip_address":"185.181.62.21", "ip_reverse":"static.185.181.62.21.gigahost.no", "ip_traffic_sum":"0", "ip_pkts_sum":"0", "ip_nullroute":"0", "ip_routed_to":"7795", "ip_type":"extra", "ip_netmask":"255.255.255.0", "ip_gateway":"185.181.62.1" } ], "subnets":[ { "sub_id":"2236", "sub_parent_id":"675", "srv_id":"3523", "device_id":"0", "sub_type":"ipv6", "sub_ipv6_type":"", "sub_network":"2a03:94e0:190e::", "sub_netmask":"48", "sub_broadcast":"", "sub_gateway":"2a03:94e0:19ff::1", "sub_cidr":"2a03:94e0:190e::/48", "sub_vlan":"1510", "sub_vrf":"1", "sub_description":"", "sub_location":"DC2", "sub_duid":"", "sub_ns":"" }, { "sub_id":"2237", "sub_parent_id":"675", "srv_id":"3523", "device_id":"0", "sub_type":"ipv6", "sub_ipv6_type":"", "sub_network":"2a03:94e0:190f::", "sub_netmask":"48", "sub_broadcast":"", "sub_gateway":"2a03:94e0:19ff::1", "sub_cidr":"2a03:94e0:190f::/48", "sub_vlan":"1510", "sub_vrf":"1", "sub_description":"", "sub_location":"DC2", "sub_duid":"", "sub_ns":"" } ], "order":{ "order_id":"3081", "payment_id":"4", "order_number":"3976", "order_date":"1528244467", "order_billing_type":"recurring", "order_billing_date":"06.07.2018", "order_billing_cycle":"1", "order_billing_days":"10", "order_status":"cancelled", "order_payment_status":"0", "order_total":"199.00", "order_cancel_reason":"" }, "attacklogs":[ ], "cancelled":null, "node":"pmx4dc2", "bw_used":0, "bw_used_in":0, "bw_used_out":0, "location":[ ], "ipmi_session":{ "kvm_id":"12", "srv_id":"xxx", "kvm_ip_address":"185.125.168.xxx", "kvm_username":"xxx", "kvm_password":"xxx", "kvm_userid":"5", "kvm_expires":"1530717076", "kvm_in_use":"1" } } ] }
PUT
/servers/{id}/name
Update servers name

Update your servers descriptive name

Parameters
server_id (numeric - inurl)
name (string)

POST
/servers/{id}/ipmi
Establish KVM/IPMI session

Establishes KVM/IPMI session with server

Sessions are valid for 3 hours at a time.

Parameters
server_id (numeric - inurl)

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":{ "kvm_ip_address":"185.125.168.xx", "username":"xxxx", "password":"xxxx" } }
GET
/servers/{id}/powerstate
Get servers powerstate

Gets your servers powerstate if supported

Parameters
server_id (numeric - inurl)

Example return data

{ "meta":{ "status":200, "status_message":"200 OK", "powerstate":true, "timestamp":1530706429 } }
GET
/servers/{id}/reboot
Reboots server

Reboots your server if supported

Parameters
server_id (numeric - inurl)

GET
/servers/{id}/power/on
Powers on server

Powers on your server if supported

Parameters
server_id (numeric - inurl)

GET
/servers/{id}/power/off
Powers off server

Powers off your server if supported

Parameters
server_id (numeric - inurl)

GET
/servers/{id}/snapshots
Get servers snapshots

Gets your servers snapshots (virtual servers)

Parameters
server_id (numeric - inurl)

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":[{ "snap_id": 123, "srv_id": 999, "snap_name":"Asdf1234", "snap_display_name":"my-snapshot", "snap_time": 1234567890, "snap_state": "pending" or "completed" } }
POST
/servers/{id}/snapshot
Create snapshot of server

Creates a snapshot of your server (virtual servers)

Required parameters
server_id (numeric - inurl)
name (string - descriptive name of snapshot)

Example return data

{ "meta":{ "status":200, "status_message":"200 OK", "message":"Snapshot is currently being created.", } }
DELETE
/servers/{id}/snapshot/{snap-id}
Delete snapshot of server

Deletes a snapshot of your server (virtual servers)

Required parameters
server_id (numeric - inurl)
snap_id (numeric - inurl)

Example return data

{ "meta":{ "status":200, "status_message":"200 OK", "message":"Snapshot has been deleted.", } }
GET
/servers/{id}/port_bits
Get servers bandwidth graphs (base64 image)

Gets servers bandwidth graphs

Parameters
server_id (numeric - inurl)

Format is base64 image data.

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":{ "graph_day":"img-data (base64)", "graph_week":"img-data (base64)", "graph_month":"img-data (base64)", "graph_year":"img-data (base64)", } }
GET
/servers/{id}/port_upkts
Get servers packets graphs (base64 image)

Gets servers packets graphs

Parameters
server_id (numeric - inurl)

Format is base64 image data.

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":{ "graph_day":"img-data (base64)", "graph_week":"img-data (base64)", "graph_month":"img-data (base64)", "graph_year":"img-data (base64)", } }
GET
/reinstall/distro
Get list of available distributions

Gets list of available distributions for reinstall

Parameters
none

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":[ { "dist_id":"1", "type_id":"1", "dist_name":"CentOS", "dist_value":"centos", "dist_logo":"/images/os/centos.png", "dist_description":"", "dist_active":"1" } }
GET
/reinstall/distro/{id}
Get list of available operating systems

Gets list of available operating systems for reinstall

Parameters
none

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":[ { "os_id":"47", "dist_id":"1", "os_name":"CentOS 6 64-bit", "os_release":"centos", "os_dist":"6", "os_arch":"amd64", "os_custom_partition":"1", "os_single_disk_only":"0", "os_support_raid":"1", "os_dedicated_only":"0", "os_minram":"0" } }
POST
/servers/{id}/reinstall
Reinstall server

Initiates reinstall of server

Required parameters
server_id (numeric - inurl)
os_id (numeric - operating system id)
language (string - OS language, e.g. en_US, nb_NO)
keyboard (string - keyboard, e.g. no, en)
timezone (string - timezone, e.g. Europe/Oslo)
hostname (string - servers hostname)

Example return data

{ "meta":{ "status":200, "status_message":"200 OK", "message":"Server install has been initiated.", "reboot":true, "root_passwd":"xxxxxx" } }
PUT
/servers/{id}/reverse
Update reverse DNS

Update reverse DNS records for IPv4 or IPv6

Parameters
server_id (numeric - inurl)

For IPv4:
ip_id (numeric)
dns (string, e.g. server.mydomain.com)

For IPv6 (whole subnet, NS delegation):
sub_id (numeric - subnets id)
dns (string, e.g. ns1.gigahost.no)

GET
/servers/{id}/isos
Get list of uploaded ISOs

Gets list of uploaded ISOs

Parameters
none

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":[ { "iso_id":"xxx", "cust_id":"xxxx", "iso_url":"http://xxxxx/debian-9.4.0-amd64-netinst.iso", "iso_name":"debian-9.4.0-amd64-netinst.iso", "iso_hash":"", "iso_size":"0", "iso_state":"uploading", "iso_mounted":"0" } ] }
POST
/servers/{id}/isos
Upload ISO for mount

Upload ISO for mount

Parameters
server_id (numeric - inurl)
iso_id (string - iso_id)

GET
/servers/{id}/upgrade
Get list of available packages to upgrade to

Get list of packages

Parameters
none

Example return data

{ "meta":{ "status":200, "status_message":"200 OK" }, "data":[ { "pkg_id":"3", "product_id":"2058", "pkg_name":"kvm2048.2018.gigahost", "pkg_cores":"2", "pkg_ram":"2048", "pkg_disk":"40", "product_name":"KVM 2048", "product_price":"199.00" }, { "pkg_id":"4", "product_id":"2059", "pkg_name":"kvm4096.2018.gigahost", "pkg_cores":"4", "pkg_ram":"4096", "pkg_disk":"50", "product_name":"KVM 4096", "product_price":"299.00" } ] }
POST
/servers/{id}/upgrade
Upgrade server to another package

Upgrade server.

Parameters
server_id (numeric - inurl)
pkg_id (numeric - package id)

POST
/servers/{id}/ipv4
Order additional IP addresses

Order IPs

Parameters
server_id (numeric - inurl)
ip_type (string - "l2" or "l3")

Pass "l2" to receive a layer 2, non routed IP. Pass "l3" to receive a routed layer 3 IP.

/my

GET
/my/account
Get your account

Get your stored account data with contacts

Parameters
None

Example return data

{ "success":true, "cust_id":"1111", "cust_name":"name", "cust_company_no":"", "cust_address":"address", "cust_address2":"address2", "cust_province":"province", "cust_zipcode":"1111", "cust_city":"city", "cust_country":"country", "cust_phone":"number", "cust_email":"email", "cust_billing_email":"billing email", "cust_contacts":[ { "contact_id":"1", "contact_name":"name", "contact_email":"email", "contact_phone":"number", "contact_address":"address", "contact_zip":"1111", "contact_city":"city", "contact_username":"username", "contact_admin":"1" }, { "contact_id":"2", "contact_name":"name", "contact_email":"email", "contact_phone":"number", "contact_address":"address", "contact_zip":"1111", "contact_city":"city", "contact_username":"username", "contact_admin":"1" } ] }
GET
/my/invoices
Get your invoices

Get all your invoices

Parameters
None

Example return data

{ "success":true, "invoices":[ { "inv_id":"xxxx", "order_id":"xxxx", "order_number":"xxxx", "inv_md5":"xxx", "inv_filename":"Invoice_xxxx.pdf", "inv_number":"xxxx", "inv_date":"1463004000", "inv_duedate":"1463868000", "inv_paid":"1", "inv_total":"3240.00", "inv_vat":810, "inv_total_vat":4050 } ] }
Få 10% rabatt på vår Ryzen dedikert server Hobby med koden: HOBBYSOMMER