All URIs are relative to https://developers.hostinger.com
Method | HTTP request | Description |
---|---|---|
get_attached_public_keys_v1 | GET /api/vps/v1/virtual-machines/{virtualMachineId}/public-keys | Get attached public keys |
get_metrics_v1 | GET /api/vps/v1/virtual-machines/{virtualMachineId}/metrics | Get metrics |
get_virtual_machine_list_v1 | GET /api/vps/v1/virtual-machines | Get virtual machine list |
get_virtual_machine_v1 | GET /api/vps/v1/virtual-machines/{virtualMachineId} | Get virtual machine |
recreate_virtual_machine_v1 | POST /api/vps/v1/virtual-machines/{virtualMachineId}/recreate | Recreate virtual machine |
reset_hostname_v1 | DELETE /api/vps/v1/virtual-machines/{virtualMachineId}/hostname | Reset hostname |
restart_virtual_machine_v1 | POST /api/vps/v1/virtual-machines/{virtualMachineId}/restart | Restart virtual machine |
set_hostname_v1 | PUT /api/vps/v1/virtual-machines/{virtualMachineId}/hostname | Set hostname |
set_nameservers_v1 | PUT /api/vps/v1/virtual-machines/{virtualMachineId}/nameservers | Set nameservers |
set_panel_password_v1 | PUT /api/vps/v1/virtual-machines/{virtualMachineId}/panel-password | Set panel password |
set_root_password_v1 | PUT /api/vps/v1/virtual-machines/{virtualMachineId}/root-password | Set root password |
setup_new_virtual_machine_v1 | POST /api/vps/v1/virtual-machines/{virtualMachineId}/setup | Setup new virtual machine |
start_virtual_machine_v1 | POST /api/vps/v1/virtual-machines/{virtualMachineId}/start | Start virtual machine |
stop_virtual_machine_v1 | POST /api/vps/v1/virtual-machines/{virtualMachineId}/stop | Stop virtual machine |
VPSGetPublicKeyListV1200Response get_attached_public_keys_v1(virtual_machine_id, page=page)
Get attached public keys
This endpoint retrieves a list of public keys attached to a specified virtual machine.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vps_get_public_key_list_v1200_response import VPSGetPublicKeyListV1200Response
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
page = 1 # int | Page number (optional)
try:
# Get attached public keys
api_response = api_instance.get_attached_public_keys_v1(virtual_machine_id, page=page)
print("The response of VPSVirtualMachineApi->get_attached_public_keys_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->get_attached_public_keys_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
page | int | Page number | [optional] |
VPSGetPublicKeyListV1200Response
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1MetricsMetricsCollection get_metrics_v1(virtual_machine_id, date_from, date_to)
Get metrics
This endpoint retrieves the historical metrics for a specified virtual machine. It includes the following metrics:
- CPU usage
- Memory usage
- Disk usage
- Network usage
- Uptime
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_metrics_metrics_collection import VPSV1MetricsMetricsCollection
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
date_from = '2025-05-01T00:00:00Z' # str | the date-time notation as defined by RFC 3339, section 5.6
date_to = '2025-06-01T00:00:00Z' # str | the date-time notation as defined by RFC 3339, section 5.6
try:
# Get metrics
api_response = api_instance.get_metrics_v1(virtual_machine_id, date_from, date_to)
print("The response of VPSVirtualMachineApi->get_metrics_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->get_metrics_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
date_from | str | the date-time notation as defined by RFC 3339, section 5.6 | |
date_to | str | the date-time notation as defined by RFC 3339, section 5.6 |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
422 | Validation error response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List[VPSV1VirtualMachineVirtualMachineResource] get_virtual_machine_list_v1()
Get virtual machine list
This endpoint retrieves a list of all available virtual machines.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_virtual_machine_virtual_machine_resource import VPSV1VirtualMachineVirtualMachineResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
try:
# Get virtual machine list
api_response = api_instance.get_virtual_machine_list_v1()
print("The response of VPSVirtualMachineApi->get_virtual_machine_list_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->get_virtual_machine_list_v1: %s\n" % e)
This endpoint does not need any parameter.
List[VPSV1VirtualMachineVirtualMachineResource]
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1VirtualMachineVirtualMachineResource get_virtual_machine_v1(virtual_machine_id)
Get virtual machine
This endpoint retrieves detailed information about a specified virtual machine.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_virtual_machine_virtual_machine_resource import VPSV1VirtualMachineVirtualMachineResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
try:
# Get virtual machine
api_response = api_instance.get_virtual_machine_v1(virtual_machine_id)
print("The response of VPSVirtualMachineApi->get_virtual_machine_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->get_virtual_machine_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID |
VPSV1VirtualMachineVirtualMachineResource
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource recreate_virtual_machine_v1(virtual_machine_id, vpsv1_virtual_machine_recreate_request)
Recreate virtual machine
This endpoint will recreate a virtual machine from scratch. The recreation process involves reinstalling the operating system and resetting the virtual machine to its initial state. Snapshots, if there are any, will be deleted.
Password will be checked against leaked password databases. Requirements for the password are:
- At least 8 characters long
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- Is not leaked publicly
This operation is irreversible and will result in the loss of all data stored on the virtual machine!
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.models.vpsv1_virtual_machine_recreate_request import VPSV1VirtualMachineRecreateRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
vpsv1_virtual_machine_recreate_request = hostinger_api.VPSV1VirtualMachineRecreateRequest() # VPSV1VirtualMachineRecreateRequest |
try:
# Recreate virtual machine
api_response = api_instance.recreate_virtual_machine_v1(virtual_machine_id, vpsv1_virtual_machine_recreate_request)
print("The response of VPSVirtualMachineApi->recreate_virtual_machine_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->recreate_virtual_machine_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
vpsv1_virtual_machine_recreate_request | VPSV1VirtualMachineRecreateRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
422 | Validation error response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource reset_hostname_v1(virtual_machine_id)
Reset hostname
This endpoint resets the hostname and PTR record of a specified virtual machine to the default value.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
try:
# Reset hostname
api_response = api_instance.reset_hostname_v1(virtual_machine_id)
print("The response of VPSVirtualMachineApi->reset_hostname_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->reset_hostname_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource restart_virtual_machine_v1(virtual_machine_id)
Restart virtual machine
This endpoint restarts a specified virtual machine. This is equivalent to fully stopping and starting the virtual machine. If the virtual machine was stopped, it will be started.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
try:
# Restart virtual machine
api_response = api_instance.restart_virtual_machine_v1(virtual_machine_id)
print("The response of VPSVirtualMachineApi->restart_virtual_machine_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->restart_virtual_machine_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource set_hostname_v1(virtual_machine_id, vpsv1_virtual_machine_hostname_update_request)
Set hostname
This endpoint sets the hostname for a specified virtual machine. Changing hostname does not update PTR record automatically. If you want your virtual machine to be reachable by a hostname, you need to point your domain A/AAAA records to virtual machine IP as well.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.models.vpsv1_virtual_machine_hostname_update_request import VPSV1VirtualMachineHostnameUpdateRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
vpsv1_virtual_machine_hostname_update_request = hostinger_api.VPSV1VirtualMachineHostnameUpdateRequest() # VPSV1VirtualMachineHostnameUpdateRequest |
try:
# Set hostname
api_response = api_instance.set_hostname_v1(virtual_machine_id, vpsv1_virtual_machine_hostname_update_request)
print("The response of VPSVirtualMachineApi->set_hostname_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->set_hostname_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
vpsv1_virtual_machine_hostname_update_request | VPSV1VirtualMachineHostnameUpdateRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
422 | Validation error response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource set_nameservers_v1(virtual_machine_id, vpsv1_virtual_machine_nameservers_update_request)
Set nameservers
This endpoint sets the nameservers for a specified virtual machine. Be aware, that improper nameserver configuration can lead to the virtual machine being unable to resolve domain names.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.models.vpsv1_virtual_machine_nameservers_update_request import VPSV1VirtualMachineNameserversUpdateRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
vpsv1_virtual_machine_nameservers_update_request = hostinger_api.VPSV1VirtualMachineNameserversUpdateRequest() # VPSV1VirtualMachineNameserversUpdateRequest |
try:
# Set nameservers
api_response = api_instance.set_nameservers_v1(virtual_machine_id, vpsv1_virtual_machine_nameservers_update_request)
print("The response of VPSVirtualMachineApi->set_nameservers_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->set_nameservers_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
vpsv1_virtual_machine_nameservers_update_request | VPSV1VirtualMachineNameserversUpdateRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
422 | Validation error response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource set_panel_password_v1(virtual_machine_id, vpsv1_virtual_machine_panel_password_update_request)
Set panel password
This endpoint sets the panel password for a specified virtual machine. If virtual machine does not use panel OS, the request will still be processed without any effect. Requirements for the password is the same as in the recreate virtual machine endpoint.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.models.vpsv1_virtual_machine_panel_password_update_request import VPSV1VirtualMachinePanelPasswordUpdateRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
vpsv1_virtual_machine_panel_password_update_request = hostinger_api.VPSV1VirtualMachinePanelPasswordUpdateRequest() # VPSV1VirtualMachinePanelPasswordUpdateRequest |
try:
# Set panel password
api_response = api_instance.set_panel_password_v1(virtual_machine_id, vpsv1_virtual_machine_panel_password_update_request)
print("The response of VPSVirtualMachineApi->set_panel_password_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->set_panel_password_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
vpsv1_virtual_machine_panel_password_update_request | VPSV1VirtualMachinePanelPasswordUpdateRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
422 | Validation error response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource set_root_password_v1(virtual_machine_id, vpsv1_virtual_machine_root_password_update_request)
Set root password
This endpoint sets the root password for a specified virtual machine. Requirements for the password is the same as in the recreate virtual machine endpoint.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.models.vpsv1_virtual_machine_root_password_update_request import VPSV1VirtualMachineRootPasswordUpdateRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
vpsv1_virtual_machine_root_password_update_request = hostinger_api.VPSV1VirtualMachineRootPasswordUpdateRequest() # VPSV1VirtualMachineRootPasswordUpdateRequest |
try:
# Set root password
api_response = api_instance.set_root_password_v1(virtual_machine_id, vpsv1_virtual_machine_root_password_update_request)
print("The response of VPSVirtualMachineApi->set_root_password_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->set_root_password_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
vpsv1_virtual_machine_root_password_update_request | VPSV1VirtualMachineRootPasswordUpdateRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
422 | Validation error response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1VirtualMachineVirtualMachineResource setup_new_virtual_machine_v1(virtual_machine_id, vpsv1_virtual_machine_setup_request)
Setup new virtual machine
This endpoint will setup newly purchased virtual machine. Such virtual machines has initial
state.
New virtual machine can be purchased using /api/billing/v1/orders
endpoint.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_virtual_machine_setup_request import VPSV1VirtualMachineSetupRequest
from hostinger_api.models.vpsv1_virtual_machine_virtual_machine_resource import VPSV1VirtualMachineVirtualMachineResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
vpsv1_virtual_machine_setup_request = hostinger_api.VPSV1VirtualMachineSetupRequest() # VPSV1VirtualMachineSetupRequest |
try:
# Setup new virtual machine
api_response = api_instance.setup_new_virtual_machine_v1(virtual_machine_id, vpsv1_virtual_machine_setup_request)
print("The response of VPSVirtualMachineApi->setup_new_virtual_machine_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->setup_new_virtual_machine_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
vpsv1_virtual_machine_setup_request | VPSV1VirtualMachineSetupRequest |
VPSV1VirtualMachineVirtualMachineResource
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
422 | Validation error response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource start_virtual_machine_v1(virtual_machine_id)
Start virtual machine
This endpoint starts a specified virtual machine. If the virtual machine is already running, the request will still be processed without any effect.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
try:
# Start virtual machine
api_response = api_instance.start_virtual_machine_v1(virtual_machine_id)
print("The response of VPSVirtualMachineApi->start_virtual_machine_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->start_virtual_machine_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSV1ActionActionResource stop_virtual_machine_v1(virtual_machine_id)
Stop virtual machine
This endpoint stops a specified virtual machine. If the virtual machine is already stopped, the request will still be processed without any effect.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.VPSVirtualMachineApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
try:
# Stop virtual machine
api_response = api_instance.stop_virtual_machine_v1(virtual_machine_id)
print("The response of VPSVirtualMachineApi->stop_virtual_machine_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSVirtualMachineApi->stop_virtual_machine_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]