All URIs are relative to https://cpanel-server.tld:2083/execute
| Method | HTTP request | Description |
|---|---|---|
| create_full_access | GET /Tokens/create_full_access | Create cPanel API token |
| rename | GET /Tokens/rename | Update cPanel API token's name |
| revoke | GET /Tokens/revoke | Remove cPanel API token |
| tokens_list | GET /Tokens/list | Return cPanel API tokens |
InlineResponse200517 create_full_access(name, expires_at=expires_at)
Create cPanel API token
This function creates a new API token with full access to all of a cPanel account's features.
Note:
The token only grants access to the features that the account has access to. For example, if you disable the File Manager feature, the token can't access it.
- Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200517 import InlineResponse200517
from clientapi_cpanel.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
host = "https://cpanel-server.tld:2083/execute"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = clientapi_cpanel.APITokenManagementApi(api_client)
name = 'example' # str | The API token's name. **Note:** The name may **only** contain alphanumeric characters, dashes (`-`), and underscores (`_`).
expires_at = 1609372800 # int | The API token's expiration time. **Important:** * When an API token expires the system does **not** delete it. You **must** manually delete expired API tokens. * If you do not use this parameter, the API token will **not** expire. (optional)
try:
# Create cPanel API token
api_response = api_instance.create_full_access(name, expires_at=expires_at)
print("The response of APITokenManagementApi->create_full_access:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling APITokenManagementApi->create_full_access: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| name | str | The API token's name. Note: The name may only contain alphanumeric characters, dashes (`-`), and underscores (`_`). | |
| expires_at | int | The API token's expiration time. Important: * When an API token expires the system does not delete it. You must manually delete expired API tokens. * If you do not use this parameter, the API token will not expire. | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | HTTP Request was successful. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse200519 rename(name, new_name)
Update cPanel API token's name
This function renames a cPanel account's existing API token.
- Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200519 import InlineResponse200519
from clientapi_cpanel.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
host = "https://cpanel-server.tld:2083/execute"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = clientapi_cpanel.APITokenManagementApi(api_client)
name = 'example' # str | The API token's name.
new_name = 'newexample' # str | The new name for the API token. **Note:** The name may only contain alphanumeric characters, dashes (`-`), and underscores (`_`).
try:
# Update cPanel API token's name
api_response = api_instance.rename(name, new_name)
print("The response of APITokenManagementApi->rename:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling APITokenManagementApi->rename: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| name | str | The API token's name. | |
| new_name | str | The new name for the API token. Note: The name may only contain alphanumeric characters, dashes (`-`), and underscores (`_`). |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | HTTP Request was successful. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse200520 revoke(name)
Remove cPanel API token
This function removes an API token from a cPanel account.
- Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200520 import InlineResponse200520
from clientapi_cpanel.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
host = "https://cpanel-server.tld:2083/execute"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = clientapi_cpanel.APITokenManagementApi(api_client)
name = 'example' # str | The API token to remove.
try:
# Remove cPanel API token
api_response = api_instance.revoke(name)
print("The response of APITokenManagementApi->revoke:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling APITokenManagementApi->revoke: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| name | str | The API token to remove. |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | HTTP Request was successful. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse200518 tokens_list()
Return cPanel API tokens
This function returns a list of a cPanel account's API tokens.
- Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200518 import InlineResponse200518
from clientapi_cpanel.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
host = "https://cpanel-server.tld:2083/execute"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = clientapi_cpanel.APITokenManagementApi(api_client)
try:
# Return cPanel API tokens
api_response = api_instance.tokens_list()
print("The response of APITokenManagementApi->tokens_list:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling APITokenManagementApi->tokens_list: %s\n" % e)This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | HTTP Request was successful. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]