Skip to content

truehostcloud/plesk-wp-toolkit-client

Repository files navigation

plesk-wp-toolkit-client

REST API documentation & sandbox usage instructions

Initial setup

Plesk

  1. Open 'Tools & Settings' > 'Remote API (REST)' > 'WP Toolkit REST API'
  2. In the 'Servers' dropdown choose 'Public API endpoint for Plesk'
  3. Specify the IP address or the hostname of your server in the 'host' field and click 'Authorize':
  • 3a. Provide username and password in the 'httpBasic' section, click 'Authorize', then 'Close'
  • 3b. Fill out the 'pleskApiToken' field, click 'Authorize', then 'Close'

WHM & cPanel

  1. Open WP Toolkit > 'Global Settings' > 'Open REST API documentation'
  2. In the 'Servers' dropdown choose 'Public API endpoint for WHM'
  3. Specify the IP address or the hostname of your server in the 'host' field
  4. Insert your current session identifier (in '/cpsessXXXXX' format) in the 'cpanelOrWhmSecurityToken' field. You can copy this identifier from the browser address bar
  5. Click 'Authorize', provide username and password in the 'httpBasic' section, click 'Authorize', then 'Close'

Note: session identifier is not required for sending external requests to WP Toolkit REST API, it is needed only for this sandbox

How to perform an API request

  1. Choose an API resource from the list, click on it to expand, and click 'Try it out'
  2. Prefill the fields with corresponding data and click 'Execute'. If a field is not marked as requried, you can leave it empty
  3. Scroll down the page to see the results of API request execution

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 6.6.5-9203
  • Package version: 1.0.0
  • Generator version: 7.11.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.8+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import plesk_wp_toolkit_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import plesk_wp_toolkit_client

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import plesk_wp_toolkit_client
from plesk_wp_toolkit_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://example.com/api/modules/wp-toolkit
# See configuration.py for a list of all supported configuration parameters.
configuration = plesk_wp_toolkit_client.Configuration(
    host = "https://example.com/api/modules/wp-toolkit"
)

# 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: httpBasic
configuration = plesk_wp_toolkit_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Configure API key authorization: pleskApiToken
configuration.api_key['pleskApiToken'] = os.environ["API_KEY"]

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


# Enter a context with an instance of the API client
with plesk_wp_toolkit_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = plesk_wp_toolkit_client.BackgroundTasksApi(api_client)
    task_id = 7 # int | Task ID
    task_code = 'task_install' # str | Task code

    try:
        api_response = api_instance.get_background_task(task_id, task_code)
        print("The response of BackgroundTasksApi->get_background_task:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling BackgroundTasksApi->get_background_task: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://example.com/api/modules/wp-toolkit

Class Method HTTP request Description
BackgroundTasksApi get_background_task GET /v1/background-tasks/{taskCode}/{taskId}
ChangelogsApi get_changelogs GET /v1/changelogs
InstallationsApi create_installation POST /v1/installations
InstallationsApi get_installation GET /v1/installations/{installationId}
InstallationsApi get_installation_stub GET /v1/installer/installation-stub
InstallationsApi get_installations GET /v1/installations
InstallationsApi login_installation POST /v1/installations/{installationId}/login
InstallationsApi validate_installation_path POST /v1/installer/path-validator
InstallationsAccountApi get_setup_drawer_settings GET /v1/installations/{installationId}/account
InstallationsAccountApi get_wp_credentials GET /v1/installations/{installationId}/credentials
InstallationsAccountApi update_setup_drawer_settings PATCH /v1/installations/{installationId}/account
InstallationsBackupsApi get_installation_backups_info GET /v1/installations/{installationId}/backups
InstallationsBackupsApi get_installation_backups_meta GET /v1/installations/{installationId}/backups/meta
InstallationsBackupsApi remove_installation_backups DELETE /v1/installations/{installationId}/backups
InstallationsFeaturesBackupsApi create_installation_backup POST /v1/features/backups/creator
InstallationsFeaturesBackupsApi restore_installation_backup POST /v1/features/backups/restorer
InstallationsFeaturesCacheApi clean_installation_cache POST /v1/cache-cleaner
InstallationsFeaturesCloneApi clone_installation POST /v1/cloner
InstallationsFeaturesCloneApi get_clone_stub GET /v1/installations/{installationId}/features/clone/stub
InstallationsFeaturesCloneApi validate_clone_path POST /v1/installations/{installationId}/features/clone/path-validator
InstallationsFeaturesDebugApi get_word_press_debug_settings GET /v1/installations/{installationId}/features/debug/settings
InstallationsFeaturesDebugApi update_word_press_debug_settings PATCH /v1/installations/{installationId}/features/debug/settings
InstallationsFeaturesDebugApi update_word_press_debug_status PUT /v1/installations/{installationId}/features/debug/status
InstallationsFeaturesHotlinkProtectionApi get_hotlink_protection_settings_meta GET /v1/installations/{installationId}/features/hotlink-protection/settings/meta
InstallationsFeaturesHotlinkProtectionApi reset_hotlink_protection_settings DELETE /v1/installations/{installationId}/features/hotlink-protection/settings
InstallationsFeaturesHotlinkProtectionApi update_hotlink_protection_settings PUT /v1/installations/{installationId}/features/hotlink-protection/settings
InstallationsFeaturesHotlinkProtectionApi update_hotlink_protection_status PUT /v1/installations/{installationId}/features/hotlink-protection/status
InstallationsFeaturesIndexingApi update_indexing_status PUT /v1/installations/{installationId}/features/indexing/status
InstallationsFeaturesIntegrityApi get_integrity GET /v1/installations/{installationId}/features/integrity
InstallationsFeaturesMaintenanceApi create_maintenance_preview POST /v1/installations/{installationId}/features/maintenance/preview
InstallationsFeaturesMaintenanceApi get_maintenance_settings GET /v1/installations/{installationId}/features/maintenance/settings
InstallationsFeaturesMaintenanceApi get_maintenance_template_customization_url GET /v1/installations/{installationId}/features/maintenance/template-customization-url
InstallationsFeaturesMaintenanceApi restore_maintenance_template DELETE /v1/installations/{installationId}/features/maintenance/template
InstallationsFeaturesMaintenanceApi update_maintenance_settings PUT /v1/installations/{installationId}/features/maintenance/settings
InstallationsFeaturesMaintenanceApi update_maintenance_status PUT /v1/installations/{installationId}/features/maintenance/status
InstallationsFeaturesNginxCachingApi update_nginx_caching_status PUT /v1/installations/{installationId}/features/nginx-caching/status
InstallationsFeaturesPasswordProtectionApi get_password_protection GET /v1/installations/{installationId}/features/password-protection
InstallationsFeaturesPasswordProtectionApi update_password_protection PATCH /v1/installations/{installationId}/features/password-protection
InstallationsFeaturesPhpApi get_available_php_handlers GET /v1/installations/{installationId}/features/php/handlers
InstallationsFeaturesSecurityPoliciesApi get_installation_security_policies GET /v1/installations/{installationId}/features/vulnerability/security-policies
InstallationsFeaturesSecurityPoliciesApi update_installation_security_policies PATCH /v1/installations/{installationId}/features/vulnerability/security-policies
InstallationsFeaturesSmartPhpUpdateApi run_smart_php_update POST /v1/smart-php-updater
InstallationsFeaturesUpdatesApi get_auto_update_settings GET /v1/installations/{installationId}/features/updates/settings
InstallationsFeaturesUpdatesApi update_auto_update_settings PUT /v1/installations/{installationId}/features/updates/settings
InstallationsFeaturesUpdatesApi update_installations_auto_updates_settings POST /v1/features/updates/settings
InstallationsFeaturesUpdatesApi update_installations_auto_updates_settings_v2 POST /v2/features/updates/settings
InstallationsFeaturesUpdatesPhpApi accept_smart_php_update POST /v1/installations/{installationId}/features/updates/php/result
InstallationsFeaturesUpdatesPhpApi discard_smart_php_update DELETE /v1/installations/{installationId}/features/updates/php/result
InstallationsFeaturesUpdatesPhpApi get_smart_php_update_result GET /v1/installations/{installationId}/features/updates/php/result
InstallationsFeaturesUpdatesPhpApi get_smart_php_update_stub GET /v1/installations/{installationId}/features/updates/php/stub
InstallationsFeaturesUpdatesSmartApi apply_smart_update POST /v1/installations/{installationId}/features/updates/smart/result
InstallationsFeaturesUpdatesSmartApi discard_smart_update DELETE /v1/installations/{installationId}/features/updates/smart/result
InstallationsFeaturesUpdatesSmartApi get_smart_update_result GET /v1/installations/{installationId}/features/updates/smart/result
InstallationsFeaturesUpdatesSmartApi update_smart_updates_status PUT /v1/installations/{installationId}/features/updates/smart/status
InstallationsFeaturesVirtualPatchesApi update_virtual_patches_protection_status POST /v1/features/virtual-patches/protector
InstallationsFeaturesVulnerabilityFilteringApi update_vulnerability_filtering PATCH /v1/installations/{installationId}/features/vulnerability/filtering
InstallationsFeaturesWpCronTakeoverApi get_wp_cron_takeover_meta GET /v1/installations/{installationId}/features/wp-cron-takeover/meta
InstallationsFeaturesWpCronTakeoverApi update_wp_cron_takeover PATCH /v1/installations/{installationId}/features/wp-cron-takeover
InstallationsLabelsApi get_installation_labels_meta GET /v1/installations/{installationId}/labels/meta
InstallationsLabelsApi update_installation_labels PUT /v1/installations/{installationId}/labels
InstallationsPluginsApi get_installation_plugins GET /v1/installations/{installationId}/plugins
InstallationsPluginsApi get_installations_plugins GET /v1/installations/{installationId}/features/catalog/plugins
InstallationsPluginsApi instalations_plugins_activate_deactivate PUT /v1/installations/{installationId}/plugins/{slug}/status
InstallationsPluginsApi instalations_plugins_info GET /v1/installations/{installationId}/features/catalog/plugins/{slug}
InstallationsPluginsApi instalations_plugins_install POST /v1/installations/{installationId}/plugins
InstallationsPluginsApi instalations_plugins_uninstall DELETE /v1/installations/{installationId}/plugins
InstallationsPluginsApi instalations_plugins_upload_and_install POST /v1/installations/{installationId}/features/uploader/plugins
InstallationsPluginsApi update_installations_plugins PATCH /v1/installations/{installationId}/plugins
InstallationsThemesApi get_installation_themes GET /v1/installations/{installationId}/themes
InstallationsThemesApi get_installations_themes GET /v1/installations/{installationId}/features/catalog/themes
InstallationsThemesApi instalations_themes_activate PUT /v1/installations/{installationId}/themes/{slug}/status
InstallationsThemesApi instalations_themes_install POST /v1/installations/{installationId}/themes
InstallationsThemesApi instalations_themes_uninstall DELETE /v1/installations/{installationId}/themes
InstallationsThemesApi instalations_themes_upload_and_install POST /v1/installations/{installationId}/features/uploader/themes
InstallationsThemesApi update_installations_themes PATCH /v1/installations/{installationId}/themes
LicensingApi get_license_info GET /v1/license-info
LicensingApi update_license_info POST /v1/license-info/updater
RemoverApi get_installations_remove_confirmation GET /v1/remover/confirmation
ScannerApi scan_installations POST /v1/scanner
SecurityMeasuresApi check_security POST /v1/security-measures/checker
SecurityMeasuresApi get_security_measures GET /v1/security-measures
SecurityMeasuresApi get_security_measures_per_installations GET /v1/security-measures/checker
SecurityMeasuresApi resolve_security_measures POST /v1/security-measures/resolver
SecurityMeasuresApi revert_security_measures POST /v1/security-measures/reverter
SetsApi add_plugins_to_set POST /v1/sets/{setId}/plugins
SetsApi add_themes_to_set POST /v1/sets/{setId}/themes
SetsApi create_set POST /v1/sets
SetsApi delete_set DELETE /v1/sets/{setId}
SetsApi get_set_details GET /v1/sets/{setId}
SetsApi get_sets_list GET /v1/sets
SetsApi install_set POST /v1/sets-installer
SetsApi remove_plugin_from_set DELETE /v1/sets/{setId}/plugins/{pluginSlug}
SetsApi remove_theme_from_set DELETE /v1/sets/{setId}/themes/{themeSlug}
SetsApi set_plugins_to_set PUT /v1/sets/{setId}/plugins
SetsApi set_themes_to_set PUT /v1/sets/{setId}/themes
SetsApi update_set PATCH /v1/sets/{setId}
SetsApi upload_plugin_to_set POST /v1/sets/{setId}/features/uploader/plugins
SetsApi upload_theme_to_set POST /v1/sets/{setId}/features/uploader/themes
UpdaterApi launch_update POST /v1/updater
UpdaterCheckerApi fetch_available_updates GET /v1/updates-checker
UpdaterCheckerApi refresh_available_updates POST /v1/updates-checker
VulnerabilitiesApi check_installations_vulnerability POST /v1/vulnerabilities-checker
VulnerabilitiesApi fetch_installations_vulnerability_statuses GET /v1/vulnerabilities-checker

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

httpBasic

  • Type: HTTP basic authentication

pleskApiToken

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

Author

About

Plesk Wordpress Toolkit API Client

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages