|
| 1 | +# hostinger_api.HostingCDNApi |
| 2 | + |
| 3 | +All URIs are relative to *https://developers.hostinger.com* |
| 4 | + |
| 5 | +Method | HTTP request | Description |
| 6 | +------------- | ------------- | ------------- |
| 7 | +[**disable_cdnv1**](HostingCDNApi.md#disable_cdnv1) | **POST** /api/hosting/v1/accounts/{username}/websites/{domain}/cdn/disable | Disable CDN |
| 8 | +[**enable_cdnv1**](HostingCDNApi.md#enable_cdnv1) | **POST** /api/hosting/v1/accounts/{username}/websites/{domain}/cdn/enable | Enable CDN |
| 9 | +[**get_cdn_status_v1**](HostingCDNApi.md#get_cdn_status_v1) | **GET** /api/hosting/v1/accounts/{username}/websites/{domain}/cdn/status | Get CDN status |
| 10 | +[**purge_cdn_cache_v1**](HostingCDNApi.md#purge_cdn_cache_v1) | **DELETE** /api/hosting/v1/accounts/{username}/websites/{domain}/cdn/purge | Purge CDN cache |
| 11 | + |
| 12 | + |
| 13 | +# **disable_cdnv1** |
| 14 | +> CommonSuccessEmptyResource disable_cdnv1(username, domain) |
| 15 | +
|
| 16 | +Disable CDN |
| 17 | + |
| 18 | +Turns off the Hostinger CDN for the website domain. Once DNS propagation completes, the |
| 19 | +website content is served directly from the origin server. Repeating the call is safe; when |
| 20 | +CDN is already disabled, it applies the DNS change again. |
| 21 | + |
| 22 | +Returns 422 for platform-managed domains (for example `*.hostingersite.com` and |
| 23 | +`*.app-preview.com`), where CDN cannot be disabled, even when CDN is already off. Also returns |
| 24 | +422 while the account is being moved to another server (retry after the move finishes), or |
| 25 | +when the CDN provider rejects the change. Returns 404 when the domain is not a website on the |
| 26 | +account. |
| 27 | + |
| 28 | +### Example |
| 29 | + |
| 30 | +* Bearer Authentication (apiToken): |
| 31 | + |
| 32 | +```python |
| 33 | +import hostinger_api |
| 34 | +from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource |
| 35 | +from hostinger_api.rest import ApiException |
| 36 | +from pprint import pprint |
| 37 | + |
| 38 | + |
| 39 | +# Configure Bearer authorization: apiToken |
| 40 | +configuration = hostinger_api.Configuration( |
| 41 | + access_token = os.environ["BEARER_TOKEN"] |
| 42 | +) |
| 43 | + |
| 44 | +# Enter a context with an instance of the API client |
| 45 | +with hostinger_api.ApiClient(configuration) as api_client: |
| 46 | + # Create an instance of the API class |
| 47 | + api_instance = hostinger_api.HostingCDNApi(api_client) |
| 48 | + username = 'u123456789' # str | |
| 49 | + domain = 'mydomain.tld' # str | Domain name |
| 50 | + |
| 51 | + try: |
| 52 | + # Disable CDN |
| 53 | + api_response = api_instance.disable_cdnv1(username, domain) |
| 54 | + print("The response of HostingCDNApi->disable_cdnv1:\n") |
| 55 | + pprint(api_response) |
| 56 | + except Exception as e: |
| 57 | + print("Exception when calling HostingCDNApi->disable_cdnv1: %s\n" % e) |
| 58 | +``` |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +### Parameters |
| 63 | + |
| 64 | + |
| 65 | +Name | Type | Description | Notes |
| 66 | +------------- | ------------- | ------------- | ------------- |
| 67 | + **username** | **str**| | |
| 68 | + **domain** | **str**| Domain name | |
| 69 | + |
| 70 | +### Return type |
| 71 | + |
| 72 | +[**CommonSuccessEmptyResource**](CommonSuccessEmptyResource.md) |
| 73 | + |
| 74 | +### Authorization |
| 75 | + |
| 76 | +[apiToken](../README.md#apiToken) |
| 77 | + |
| 78 | +### HTTP request headers |
| 79 | + |
| 80 | + - **Content-Type**: Not defined |
| 81 | + - **Accept**: application/json |
| 82 | + |
| 83 | +### HTTP response details |
| 84 | + |
| 85 | +| Status code | Description | Response headers | |
| 86 | +|-------------|-------------|------------------| |
| 87 | +**200** | Success empty response | - | |
| 88 | +**422** | Validation error response | - | |
| 89 | +**401** | Unauthenticated response | - | |
| 90 | +**500** | Error response | - | |
| 91 | + |
| 92 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 93 | + |
| 94 | +# **enable_cdnv1** |
| 95 | +> CommonSuccessEmptyResource enable_cdnv1(username, domain) |
| 96 | +
|
| 97 | +Enable CDN |
| 98 | + |
| 99 | +Turns on the Hostinger CDN for the website domain, which speeds up page loads and reduces the |
| 100 | +load on the server. Works for the main domain, parked domains and subdomains of the account. |
| 101 | + |
| 102 | +Enabling changes the domain's DNS records and usually takes a few seconds. After that, DNS |
| 103 | +propagation can take a few more minutes before visitors are served through the CDN. |
| 104 | + |
| 105 | +Repeating the call is safe, for example after a timeout. When CDN is already enabled, it |
| 106 | +applies the DNS change again and refreshes the CDN SSL certificate. |
| 107 | + |
| 108 | +Returns 422 when the account is disabled, while the account is being moved to another |
| 109 | +server (retry after the move finishes), or when the CDN provider rejects the change. |
| 110 | +Returns 404 when the domain is not a website on the account. |
| 111 | + |
| 112 | +### Example |
| 113 | + |
| 114 | +* Bearer Authentication (apiToken): |
| 115 | + |
| 116 | +```python |
| 117 | +import hostinger_api |
| 118 | +from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource |
| 119 | +from hostinger_api.rest import ApiException |
| 120 | +from pprint import pprint |
| 121 | + |
| 122 | + |
| 123 | +# Configure Bearer authorization: apiToken |
| 124 | +configuration = hostinger_api.Configuration( |
| 125 | + access_token = os.environ["BEARER_TOKEN"] |
| 126 | +) |
| 127 | + |
| 128 | +# Enter a context with an instance of the API client |
| 129 | +with hostinger_api.ApiClient(configuration) as api_client: |
| 130 | + # Create an instance of the API class |
| 131 | + api_instance = hostinger_api.HostingCDNApi(api_client) |
| 132 | + username = 'u123456789' # str | |
| 133 | + domain = 'mydomain.tld' # str | Domain name |
| 134 | + |
| 135 | + try: |
| 136 | + # Enable CDN |
| 137 | + api_response = api_instance.enable_cdnv1(username, domain) |
| 138 | + print("The response of HostingCDNApi->enable_cdnv1:\n") |
| 139 | + pprint(api_response) |
| 140 | + except Exception as e: |
| 141 | + print("Exception when calling HostingCDNApi->enable_cdnv1: %s\n" % e) |
| 142 | +``` |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | +### Parameters |
| 147 | + |
| 148 | + |
| 149 | +Name | Type | Description | Notes |
| 150 | +------------- | ------------- | ------------- | ------------- |
| 151 | + **username** | **str**| | |
| 152 | + **domain** | **str**| Domain name | |
| 153 | + |
| 154 | +### Return type |
| 155 | + |
| 156 | +[**CommonSuccessEmptyResource**](CommonSuccessEmptyResource.md) |
| 157 | + |
| 158 | +### Authorization |
| 159 | + |
| 160 | +[apiToken](../README.md#apiToken) |
| 161 | + |
| 162 | +### HTTP request headers |
| 163 | + |
| 164 | + - **Content-Type**: Not defined |
| 165 | + - **Accept**: application/json |
| 166 | + |
| 167 | +### HTTP response details |
| 168 | + |
| 169 | +| Status code | Description | Response headers | |
| 170 | +|-------------|-------------|------------------| |
| 171 | +**200** | Success empty response | - | |
| 172 | +**422** | Validation error response | - | |
| 173 | +**401** | Unauthenticated response | - | |
| 174 | +**500** | Error response | - | |
| 175 | + |
| 176 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 177 | + |
| 178 | +# **get_cdn_status_v1** |
| 179 | +> HostingV1CdnCdnStatusResource get_cdn_status_v1(username, domain) |
| 180 | +
|
| 181 | +Get CDN status |
| 182 | + |
| 183 | +Returns whether the Hostinger CDN is enabled for the website domain. Works for the main |
| 184 | +domain, parked domains and subdomains of the account. |
| 185 | + |
| 186 | +The domain must be the exact website name as listed on the account, without a `www.` prefix. |
| 187 | +Returns 404 when the domain is not a website on the account. |
| 188 | + |
| 189 | +### Example |
| 190 | + |
| 191 | +* Bearer Authentication (apiToken): |
| 192 | + |
| 193 | +```python |
| 194 | +import hostinger_api |
| 195 | +from hostinger_api.models.hosting_v1_cdn_cdn_status_resource import HostingV1CdnCdnStatusResource |
| 196 | +from hostinger_api.rest import ApiException |
| 197 | +from pprint import pprint |
| 198 | + |
| 199 | + |
| 200 | +# Configure Bearer authorization: apiToken |
| 201 | +configuration = hostinger_api.Configuration( |
| 202 | + access_token = os.environ["BEARER_TOKEN"] |
| 203 | +) |
| 204 | + |
| 205 | +# Enter a context with an instance of the API client |
| 206 | +with hostinger_api.ApiClient(configuration) as api_client: |
| 207 | + # Create an instance of the API class |
| 208 | + api_instance = hostinger_api.HostingCDNApi(api_client) |
| 209 | + username = 'u123456789' # str | |
| 210 | + domain = 'mydomain.tld' # str | Domain name |
| 211 | + |
| 212 | + try: |
| 213 | + # Get CDN status |
| 214 | + api_response = api_instance.get_cdn_status_v1(username, domain) |
| 215 | + print("The response of HostingCDNApi->get_cdn_status_v1:\n") |
| 216 | + pprint(api_response) |
| 217 | + except Exception as e: |
| 218 | + print("Exception when calling HostingCDNApi->get_cdn_status_v1: %s\n" % e) |
| 219 | +``` |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | +### Parameters |
| 224 | + |
| 225 | + |
| 226 | +Name | Type | Description | Notes |
| 227 | +------------- | ------------- | ------------- | ------------- |
| 228 | + **username** | **str**| | |
| 229 | + **domain** | **str**| Domain name | |
| 230 | + |
| 231 | +### Return type |
| 232 | + |
| 233 | +[**HostingV1CdnCdnStatusResource**](HostingV1CdnCdnStatusResource.md) |
| 234 | + |
| 235 | +### Authorization |
| 236 | + |
| 237 | +[apiToken](../README.md#apiToken) |
| 238 | + |
| 239 | +### HTTP request headers |
| 240 | + |
| 241 | + - **Content-Type**: Not defined |
| 242 | + - **Accept**: application/json |
| 243 | + |
| 244 | +### HTTP response details |
| 245 | + |
| 246 | +| Status code | Description | Response headers | |
| 247 | +|-------------|-------------|------------------| |
| 248 | +**200** | Success response | - | |
| 249 | +**401** | Unauthenticated response | - | |
| 250 | +**500** | Error response | - | |
| 251 | + |
| 252 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 253 | + |
| 254 | +# **purge_cdn_cache_v1** |
| 255 | +> CommonSuccessEmptyResource purge_cdn_cache_v1(username, domain) |
| 256 | +
|
| 257 | +Purge CDN cache |
| 258 | + |
| 259 | +Purges the website's content from the Hostinger CDN edge cache only. The origin server cache |
| 260 | +is not touched; to clear both, use `Clear website cache`. |
| 261 | + |
| 262 | +Returns 422 when CDN is not enabled on the website. Returns 404 when the domain is not a |
| 263 | +website on the account. |
| 264 | + |
| 265 | +### Example |
| 266 | + |
| 267 | +* Bearer Authentication (apiToken): |
| 268 | + |
| 269 | +```python |
| 270 | +import hostinger_api |
| 271 | +from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource |
| 272 | +from hostinger_api.rest import ApiException |
| 273 | +from pprint import pprint |
| 274 | + |
| 275 | + |
| 276 | +# Configure Bearer authorization: apiToken |
| 277 | +configuration = hostinger_api.Configuration( |
| 278 | + access_token = os.environ["BEARER_TOKEN"] |
| 279 | +) |
| 280 | + |
| 281 | +# Enter a context with an instance of the API client |
| 282 | +with hostinger_api.ApiClient(configuration) as api_client: |
| 283 | + # Create an instance of the API class |
| 284 | + api_instance = hostinger_api.HostingCDNApi(api_client) |
| 285 | + username = 'u123456789' # str | |
| 286 | + domain = 'mydomain.tld' # str | Domain name |
| 287 | + |
| 288 | + try: |
| 289 | + # Purge CDN cache |
| 290 | + api_response = api_instance.purge_cdn_cache_v1(username, domain) |
| 291 | + print("The response of HostingCDNApi->purge_cdn_cache_v1:\n") |
| 292 | + pprint(api_response) |
| 293 | + except Exception as e: |
| 294 | + print("Exception when calling HostingCDNApi->purge_cdn_cache_v1: %s\n" % e) |
| 295 | +``` |
| 296 | + |
| 297 | + |
| 298 | + |
| 299 | +### Parameters |
| 300 | + |
| 301 | + |
| 302 | +Name | Type | Description | Notes |
| 303 | +------------- | ------------- | ------------- | ------------- |
| 304 | + **username** | **str**| | |
| 305 | + **domain** | **str**| Domain name | |
| 306 | + |
| 307 | +### Return type |
| 308 | + |
| 309 | +[**CommonSuccessEmptyResource**](CommonSuccessEmptyResource.md) |
| 310 | + |
| 311 | +### Authorization |
| 312 | + |
| 313 | +[apiToken](../README.md#apiToken) |
| 314 | + |
| 315 | +### HTTP request headers |
| 316 | + |
| 317 | + - **Content-Type**: Not defined |
| 318 | + - **Accept**: application/json |
| 319 | + |
| 320 | +### HTTP response details |
| 321 | + |
| 322 | +| Status code | Description | Response headers | |
| 323 | +|-------------|-------------|------------------| |
| 324 | +**200** | Success empty response | - | |
| 325 | +**422** | Validation error response | - | |
| 326 | +**401** | Unauthenticated response | - | |
| 327 | +**500** | Error response | - | |
| 328 | + |
| 329 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 330 | + |
0 commit comments