All URIs are relative to https://developers.hostinger.com
| Method | HTTP request | Description |
|---|---|---|
| create_domain_forwarding_v1 | POST /api/domains/v1/forwarding | Create domain forwarding |
| delete_domain_forwarding_v1 | DELETE /api/domains/v1/forwarding/{domain} | Delete domain forwarding |
| get_domain_forwarding_v1 | GET /api/domains/v1/forwarding/{domain} | Get domain forwarding |
| update_domain_forwarding_v1 | PUT /api/domains/v1/forwarding/{domain} | Update domain forwarding |
DomainsV1ForwardingForwardingResource create_domain_forwarding_v1(domains_v1_forwarding_store_request)
Create domain forwarding
Create domain forwarding configuration.
Creating a forwarding changes the domain's DNS. If the domain does not use Hostinger nameservers, they are switched to Hostinger's nameservers automatically, so website, email and other services whose DNS is hosted elsewhere stop working. The root (@) A and AAAA records in the domain's Hostinger DNS zone are also replaced with records pointing to Hostinger, even when the domain already uses Hostinger nameservers. The domain's current nameservers are returned by the domain details endpoint; confirm with the user before creating a forwarding on a domain that uses other nameservers. DNS changes can take some time to propagate.
Use this endpoint to set up domain redirects to other URLs.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.domains_v1_forwarding_forwarding_resource import DomainsV1ForwardingForwardingResource
from hostinger_api.models.domains_v1_forwarding_store_request import DomainsV1ForwardingStoreRequest
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.DomainsForwardingApi(api_client)
domains_v1_forwarding_store_request = hostinger_api.DomainsV1ForwardingStoreRequest() # DomainsV1ForwardingStoreRequest |
try:
# Create domain forwarding
api_response = api_instance.create_domain_forwarding_v1(domains_v1_forwarding_store_request)
print("The response of DomainsForwardingApi->create_domain_forwarding_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DomainsForwardingApi->create_domain_forwarding_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| domains_v1_forwarding_store_request | DomainsV1ForwardingStoreRequest |
DomainsV1ForwardingForwardingResource
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CommonSuccessEmptyResource delete_domain_forwarding_v1(domain)
Delete domain forwarding
Delete domain forwarding data.
Use this endpoint to remove redirect configuration from domains.
- 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.DomainsForwardingApi(api_client)
domain = 'mydomain.tld' # str | Domain name
try:
# Delete domain forwarding
api_response = api_instance.delete_domain_forwarding_v1(domain)
print("The response of DomainsForwardingApi->delete_domain_forwarding_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DomainsForwardingApi->delete_domain_forwarding_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| domain | str | Domain name |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DomainsV1ForwardingForwardingResource get_domain_forwarding_v1(domain)
Get domain forwarding
Retrieve domain forwarding data.
Returns 404 when the domain has no forwarding.
Use this endpoint to view current redirect configuration for domains.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.domains_v1_forwarding_forwarding_resource import DomainsV1ForwardingForwardingResource
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.DomainsForwardingApi(api_client)
domain = 'mydomain.tld' # str | Domain name
try:
# Get domain forwarding
api_response = api_instance.get_domain_forwarding_v1(domain)
print("The response of DomainsForwardingApi->get_domain_forwarding_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DomainsForwardingApi->get_domain_forwarding_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| domain | str | Domain name |
DomainsV1ForwardingForwardingResource
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DomainsV1ForwardingForwardingResource update_domain_forwarding_v1(domain, domains_v1_forwarding_update_request)
Update domain forwarding
Update domain forwarding configuration.
Updating a forwarding changes the domain's DNS. If the domain does not use Hostinger nameservers, they are switched to Hostinger's nameservers automatically, so website, email and other services whose DNS is hosted elsewhere stop working. The root (@) A and AAAA records in the domain's Hostinger DNS zone are also replaced with records pointing to Hostinger, even when the domain already uses Hostinger nameservers. The domain's current nameservers are returned by the domain details endpoint; confirm with the user before updating a forwarding on a domain that uses other nameservers. DNS changes can take some time to propagate.
Use this endpoint to modify existing redirect configuration for domains.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.domains_v1_forwarding_forwarding_resource import DomainsV1ForwardingForwardingResource
from hostinger_api.models.domains_v1_forwarding_update_request import DomainsV1ForwardingUpdateRequest
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.DomainsForwardingApi(api_client)
domain = 'mydomain.tld' # str | Domain name
domains_v1_forwarding_update_request = hostinger_api.DomainsV1ForwardingUpdateRequest() # DomainsV1ForwardingUpdateRequest |
try:
# Update domain forwarding
api_response = api_instance.update_domain_forwarding_v1(domain, domains_v1_forwarding_update_request)
print("The response of DomainsForwardingApi->update_domain_forwarding_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DomainsForwardingApi->update_domain_forwarding_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| domain | str | Domain name | |
| domains_v1_forwarding_update_request | DomainsV1ForwardingUpdateRequest |
DomainsV1ForwardingForwardingResource
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]