Skip to content

Latest commit

 

History

History
707 lines (495 loc) · 21.5 KB

File metadata and controls

707 lines (495 loc) · 21.5 KB

plesk_client.DatabasesApi

All URIs are relative to /api/v2

Method HTTP request Description
databases_get GET /databases Get databases
databases_id_delete DELETE /databases/{id} Delete database
databases_post POST /databases Create database
dbservers_get GET /dbservers Get database servers
dbusers_get GET /dbusers Get database users
dbusers_id_delete DELETE /dbusers/{id} Delete database user
dbusers_id_put PUT /dbusers/{id} Update database user
dbusers_post POST /dbusers Create database user

databases_get

List[Database] databases_get(domain=domain)

Get databases

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.database import Database
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.DatabasesApi(api_client)
    domain = 'example.com' # str | Filter data by domain name (optional)

    try:
        # Get databases
        api_response = api_instance.databases_get(domain=domain)
        print("The response of DatabasesApi->databases_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->databases_get: %s\n" % e)

Parameters

Name Type Description Notes
domain str Filter data by domain name [optional]

Return type

List[Database]

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Invalid request data -
404 Server is not found -

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

databases_id_delete

StatusResponse databases_id_delete(id)

Delete database

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.DatabasesApi(api_client)
    id = 10 # int | Database ID

    try:
        # Delete database
        api_response = api_instance.databases_id_delete(id)
        print("The response of DatabasesApi->databases_id_delete:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->databases_id_delete: %s\n" % e)

Parameters

Name Type Description Notes
id int Database 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 Database is not found -

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

databases_post

Database databases_post(body)

Create database

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.database import Database
from plesk_client.models.database_request import DatabaseRequest
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.DatabasesApi(api_client)
    body = plesk_client.DatabaseRequest() # DatabaseRequest | Database data

    try:
        # Create database
        api_response = api_instance.databases_post(body)
        print("The response of DatabasesApi->databases_post:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->databases_post: %s\n" % e)

Parameters

Name Type Description Notes
body DatabaseRequest Database data

Return type

Database

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Invalid request data -
404 Domain is not found -

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

dbservers_get

List[DatabaseServer] dbservers_get(id=id)

Get database servers

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.database_server import DatabaseServer
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.DatabasesApi(api_client)
    id = 1 # int | Filter data by database server id (optional)

    try:
        # Get database servers
        api_response = api_instance.dbservers_get(id=id)
        print("The response of DatabasesApi->dbservers_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->dbservers_get: %s\n" % e)

Parameters

Name Type Description Notes
id int Filter data by database server id [optional]

Return type

List[DatabaseServer]

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Invalid request data -
404 Server is not found -

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

dbusers_get

List[DatabaseUser] dbusers_get(db_id=db_id)

Get database users

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.database_user import DatabaseUser
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.DatabasesApi(api_client)
    db_id = 44 # int | Filter data by database ID (optional)

    try:
        # Get database users
        api_response = api_instance.dbusers_get(db_id=db_id)
        print("The response of DatabasesApi->dbusers_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->dbusers_get: %s\n" % e)

Parameters

Name Type Description Notes
db_id int Filter data by database ID [optional]

Return type

List[DatabaseUser]

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Invalid request data -
404 Domain/database is not found -

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

dbusers_id_delete

StatusResponse dbusers_id_delete(id)

Delete database user

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.DatabasesApi(api_client)
    id = 12 # int | Database user ID

    try:
        # Delete database user
        api_response = api_instance.dbusers_id_delete(id)
        print("The response of DatabasesApi->dbusers_id_delete:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->dbusers_id_delete: %s\n" % e)

Parameters

Name Type Description Notes
id int Database user 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 Database user is not found -

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

dbusers_id_put

StatusResponse dbusers_id_put(id, body)

Update database user

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.database_user_update_request import DatabaseUserUpdateRequest
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.DatabasesApi(api_client)
    id = 12 # int | Database user ID
    body = plesk_client.DatabaseUserUpdateRequest() # DatabaseUserUpdateRequest | Database user data

    try:
        # Update database user
        api_response = api_instance.dbusers_id_put(id, body)
        print("The response of DatabasesApi->dbusers_id_put:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->dbusers_id_put: %s\n" % e)

Parameters

Name Type Description Notes
id int Database user ID
body DatabaseUserUpdateRequest Database user data

Return type

StatusResponse

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Invalid request data -
404 Server/database/domain is not found -

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

dbusers_post

DatabaseUser dbusers_post(body)

Create database user

Example

  • Api Key Authentication (APIKeyHeader):
  • Basic Authentication (BasicAuth):
import plesk_client
from plesk_client.models.database_user import DatabaseUser
from plesk_client.models.database_user_request import DatabaseUserRequest
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.DatabasesApi(api_client)
    body = plesk_client.DatabaseUserRequest() # DatabaseUserRequest | Database User data

    try:
        # Create database user
        api_response = api_instance.dbusers_post(body)
        print("The response of DatabasesApi->dbusers_post:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->dbusers_post: %s\n" % e)

Parameters

Name Type Description Notes
body DatabaseUserRequest Database User data

Return type

DatabaseUser

Authorization

APIKeyHeader, BasicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Invalid request data -
404 Server/database/domain is not found -

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