Skip to content

Latest commit

 

History

History
182 lines (126 loc) · 5.57 KB

File metadata and controls

182 lines (126 loc) · 5.57 KB

plesk_client.AuthenticationApi

All URIs are relative to /api/v2

Method HTTP request Description
auth_keys_key_delete DELETE /auth/keys/{key} Delete a secret key
auth_keys_post POST /auth/keys Generate a secret key

auth_keys_key_delete

StatusResponse auth_keys_key_delete(key)

Delete a secret key

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.status_response import StatusResponse
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.AuthenticationApi(api_client)
    key = '3d2e93ad-85e6-1a3e-9f81-b9d26650e4f9' # str | Key ID

    try:
        # Delete a secret key
        api_response = api_instance.auth_keys_key_delete(key)
        print("The response of AuthenticationApi->auth_keys_key_delete:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AuthenticationApi->auth_keys_key_delete: %s\n" % e)

Parameters

Name Type Description Notes
key str Key ID

Return type

StatusResponse

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
404 Key does not exist -

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

auth_keys_post

SecretKeyResponse auth_keys_post(body)

Generate a secret key

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.secret_key_request import SecretKeyRequest
from plesk_client.models.secret_key_response import SecretKeyResponse
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.AuthenticationApi(api_client)
    body = plesk_client.SecretKeyRequest() # SecretKeyRequest | Key parameters

    try:
        # Generate a secret key
        api_response = api_instance.auth_keys_post(body)
        print("The response of AuthenticationApi->auth_keys_post:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AuthenticationApi->auth_keys_post: %s\n" % e)

Parameters

Name Type Description Notes
body SecretKeyRequest Key parameters

Return type

SecretKeyResponse

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Secret key was successfully created -
400 Invalid request data -
401 Incorrect login -

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