All URIs are relative to https://developers.hostinger.com
Method | HTTP request | Description |
---|---|---|
attach_public_key_v1 | POST /api/vps/v1/public-keys/attach/{virtualMachineId} | Attach public key |
create_new_public_key_v1 | POST /api/vps/v1/public-keys | Create new public key |
delete_a_public_key_v1 | DELETE /api/vps/v1/public-keys/{publicKeyId} | Delete a public key |
get_public_key_list_v1 | GET /api/vps/v1/public-keys | Get public key list |
VPSV1ActionActionResource attach_public_key_v1(virtual_machine_id, vpsv1_public_key_attach_request)
Attach public key
This endpoint attaches an existing public keys from your account to a specified virtual machine.
Multiple keys can be attached to a single virtual machine.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.models.vpsv1_public_key_attach_request import VPSV1PublicKeyAttachRequest
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.VPSPublicKeysApi(api_client)
virtual_machine_id = 1268054 # int | Virtual Machine ID
vpsv1_public_key_attach_request = hostinger_api.VPSV1PublicKeyAttachRequest() # VPSV1PublicKeyAttachRequest |
try:
# Attach public key
api_response = api_instance.attach_public_key_v1(virtual_machine_id, vpsv1_public_key_attach_request)
print("The response of VPSPublicKeysApi->attach_public_key_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSPublicKeysApi->attach_public_key_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
virtual_machine_id | int | Virtual Machine ID | |
vpsv1_public_key_attach_request | VPSV1PublicKeyAttachRequest |
- 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]
VPSV1PublicKeyPublicKeyResource create_new_public_key_v1(vpsv1_public_key_store_request)
Create new public key
This endpoint allows you to add a new public key to your account, which can then be attached to virtual machine instances for secure access.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_public_key_public_key_resource import VPSV1PublicKeyPublicKeyResource
from hostinger_api.models.vpsv1_public_key_store_request import VPSV1PublicKeyStoreRequest
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.VPSPublicKeysApi(api_client)
vpsv1_public_key_store_request = hostinger_api.VPSV1PublicKeyStoreRequest() # VPSV1PublicKeyStoreRequest |
try:
# Create new public key
api_response = api_instance.create_new_public_key_v1(vpsv1_public_key_store_request)
print("The response of VPSPublicKeysApi->create_new_public_key_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSPublicKeysApi->create_new_public_key_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
vpsv1_public_key_store_request | VPSV1PublicKeyStoreRequest |
VPSV1PublicKeyPublicKeyResource
- 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]
CommonSuccessEmptyResource delete_a_public_key_v1(public_key_id)
Delete a public key
This endpoint deletes a public key from your account.
Deleting public key from account does not remove it from virtual machine
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
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.VPSPublicKeysApi(api_client)
public_key_id = 6672861 # int | Public Key ID
try:
# Delete a public key
api_response = api_instance.delete_a_public_key_v1(public_key_id)
print("The response of VPSPublicKeysApi->delete_a_public_key_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSPublicKeysApi->delete_a_public_key_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
public_key_id | int | Public Key ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success empty response | - |
401 | Unauthenticated | - |
500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VPSGetPublicKeyListV1200Response get_public_key_list_v1(page=page)
Get public key list
This endpoint retrieves a list of public keys associated with your account.
- 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.VPSPublicKeysApi(api_client)
page = 1 # int | Page number (optional)
try:
# Get public key list
api_response = api_instance.get_public_key_list_v1(page=page)
print("The response of VPSPublicKeysApi->get_public_key_list_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling VPSPublicKeysApi->get_public_key_list_v1: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
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]