Skip to content

Latest commit

 

History

History
265 lines (183 loc) · 7.83 KB

File metadata and controls

265 lines (183 loc) · 7.83 KB

plesk_client.CliApi

All URIs are relative to /api/v2

Method HTTP request Description
cli_commands_get GET /cli/commands List of available commands
cli_id_call_post POST /cli/{id}/call Execute command
cli_id_ref_get GET /cli/{id}/ref Command reference

cli_commands_get

List[str] cli_commands_get()

List of available commands

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to /api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = plesk_client.Configuration(
    host = "/api/v2"
)

# 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 API key authorization: APIKeyHeader
configuration.api_key['APIKeyHeader'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyHeader'] = 'Bearer'

# Configure HTTP basic authorization: BasicAuth
configuration = plesk_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with plesk_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = plesk_client.CliApi(api_client)

    try:
        # List of available commands
        api_response = api_instance.cli_commands_get()
        print("The response of CliApi->cli_commands_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CliApi->cli_commands_get: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

List[str]

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

cli_id_call_post

CliCallResponse cli_id_call_post(id, body=body)

Execute command

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.cli_call_request import CliCallRequest
from plesk_client.models.cli_call_response import CliCallResponse
from plesk_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to /api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = plesk_client.Configuration(
    host = "/api/v2"
)

# 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 API key authorization: APIKeyHeader
configuration.api_key['APIKeyHeader'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyHeader'] = 'Bearer'

# Configure HTTP basic authorization: BasicAuth
configuration = plesk_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with plesk_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = plesk_client.CliApi(api_client)
    id = 'settings' # str | Command identifier
    body = plesk_client.CliCallRequest() # CliCallRequest | Command execution parameters (optional)

    try:
        # Execute command
        api_response = api_instance.cli_id_call_post(id, body=body)
        print("The response of CliApi->cli_id_call_post:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CliApi->cli_id_call_post: %s\n" % e)

Parameters

Name Type Description Notes
id str Command identifier
body CliCallRequest Command execution parameters [optional]

Return type

CliCallResponse

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
404 Command is not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

cli_id_ref_get

CliIdRefGet200Response cli_id_ref_get(id)

Command reference

plesk: >= 17.9

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.cli_id_ref_get200_response import CliIdRefGet200Response
from plesk_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to /api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = plesk_client.Configuration(
    host = "/api/v2"
)

# 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 API key authorization: APIKeyHeader
configuration.api_key['APIKeyHeader'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyHeader'] = 'Bearer'

# Configure HTTP basic authorization: BasicAuth
configuration = plesk_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with plesk_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = plesk_client.CliApi(api_client)
    id = 'settings' # str | Command identifier

    try:
        # Command reference
        api_response = api_instance.cli_id_ref_get(id)
        print("The response of CliApi->cli_id_ref_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CliApi->cli_id_ref_get: %s\n" % e)

Parameters

Name Type Description Notes
id str Command identifier

Return type

CliIdRefGet200Response

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
404 Command is not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]