Skip to content

Latest commit

 

History

History
503 lines (340 loc) · 21.6 KB

File metadata and controls

503 lines (340 loc) · 21.6 KB

Hostinger\WordPressInstallationsApi

All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path.

Method HTTP request Description
checkIfWordPressInstallationsAreValidV1() POST /api/hosting/v1/accounts/{username}/wordpress/installations/check-is-valid Check if WordPress installations are valid
deleteWordPressInstallationV1() DELETE /api/hosting/v1/accounts/{username}/wordpress/{software} Delete WordPress installation
detectWordPressInstallationsV1() POST /api/hosting/v1/accounts/{username}/wordpress/installations/detect Detect WordPress installations
getInstallationJWTTokenV1() GET /api/hosting/v1/accounts/{username}/wordpress/{software}/jwt-token Get installation JWT token
importWordPressWebsiteV1() POST /api/hosting/v1/accounts/{username}/websites/{domain}/wordpress/import Import WordPress website
installWordPressV1() POST /api/hosting/v1/accounts/{username}/wordpress/installations Install WordPress
listAvailableWordPressCoreUpdatesV1() GET /api/hosting/v1/accounts/{username}/wordpress/{software}/updates List available WordPress core updates
listWordPressInstallationsV1() GET /api/hosting/v1/wordpress/installations List WordPress installations
showWordPressCoreVersionV1() GET /api/hosting/v1/accounts/{username}/wordpress/{software}/version Show WordPress core version
updateWordPressCoreV1() POST /api/hosting/v1/accounts/{username}/wordpress/{software}/update Update WordPress core

checkIfWordPressInstallationsAreValidV1()

checkIfWordPressInstallationsAreValidV1($username, $wordPressV1InstallationsCheckIsValidRequest): \Hostinger\Model\WordPressV1InstallationsCheckIsValidResultResource[]

Check if WordPress installations are valid

Check whether one or more WordPress installations are valid and working correctly. Detects broken installations caused by missing files, broken plugins, themes and similar issues. Provide the WordPress installation (software) identifiers in the body. They can be obtained from GET /api/hosting/v1/wordpress/installations (the id field).

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string
$wordPressV1InstallationsCheckIsValidRequest = new \Hostinger\Model\WordPressV1InstallationsCheckIsValidRequest(); // \Hostinger\Model\WordPressV1InstallationsCheckIsValidRequest

try {
    $result = $apiInstance->checkIfWordPressInstallationsAreValidV1($username, $wordPressV1InstallationsCheckIsValidRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->checkIfWordPressInstallationsAreValidV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string
wordPressV1InstallationsCheckIsValidRequest \Hostinger\Model\WordPressV1InstallationsCheckIsValidRequest

Return type

\Hostinger\Model\WordPressV1InstallationsCheckIsValidResultResource[]

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

deleteWordPressInstallationV1()

deleteWordPressInstallationV1($username, $software, $wordPressV1InstallationsDeleteInstallationRequest): \Hostinger\Model\CommonSuccessEmptyResource

Delete WordPress installation

Delete the specified WordPress installation, with optional file and database removal. This removes all associated components including plugins, themes, staging websites and any other related data. Provide the WordPress installation (software) identifier in the path. It can be obtained from GET /api/hosting/v1/wordpress/installations (the id field).

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string
$software = 1232456789; // string | WordPress installation (software) identifier
$wordPressV1InstallationsDeleteInstallationRequest = new \Hostinger\Model\WordPressV1InstallationsDeleteInstallationRequest(); // \Hostinger\Model\WordPressV1InstallationsDeleteInstallationRequest

try {
    $result = $apiInstance->deleteWordPressInstallationV1($username, $software, $wordPressV1InstallationsDeleteInstallationRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->deleteWordPressInstallationV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string
software string WordPress installation (software) identifier
wordPressV1InstallationsDeleteInstallationRequest \Hostinger\Model\WordPressV1InstallationsDeleteInstallationRequest

Return type

\Hostinger\Model\CommonSuccessEmptyResource

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

detectWordPressInstallationsV1()

detectWordPressInstallationsV1($username): \Hostinger\Model\CommonSuccessEmptyResource

Detect WordPress installations

Trigger a background scan to detect WordPress installations for the account. This operation is asynchronous: a successful response only means the scan has been queued. Poll GET /api/hosting/v1/wordpress/installations to fetch the detected installations once the scan completes.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string

try {
    $result = $apiInstance->detectWordPressInstallationsV1($username);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->detectWordPressInstallationsV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string

Return type

\Hostinger\Model\CommonSuccessEmptyResource

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

getInstallationJWTTokenV1()

getInstallationJWTTokenV1($username, $software): \Hostinger\Model\WordPressV1InstallationsJwtTokenResource

Get installation JWT token

Return a JWT token used to authenticate requests against the specified WordPress installation, including its MCP (Model Context Protocol) endpoint. Provide the WordPress installation (software) identifier in the path. It can be obtained from GET /api/hosting/v1/wordpress/installations (the id field).

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string
$software = 1232456789; // string | WordPress installation (software) identifier

try {
    $result = $apiInstance->getInstallationJWTTokenV1($username, $software);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->getInstallationJWTTokenV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string
software string WordPress installation (software) identifier

Return type

\Hostinger\Model\WordPressV1InstallationsJwtTokenResource

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

importWordPressWebsiteV1()

importWordPressWebsiteV1($username, $domain, $wordPressV1InstallationsImportWordPressRequest): \Hostinger\Model\CommonSuccessEmptyResource

Import WordPress website

Import WordPress website to the specified domain. WARNING: this overwrites the website's existing contents and cannot be undone — verify this is intended before calling this endpoint. This endpoint allows you to import a WordPress website from archive and database files that have been uploaded to the website's directory.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string
$domain = mydomain.tld; // string | Domain name
$wordPressV1InstallationsImportWordPressRequest = new \Hostinger\Model\WordPressV1InstallationsImportWordPressRequest(); // \Hostinger\Model\WordPressV1InstallationsImportWordPressRequest

try {
    $result = $apiInstance->importWordPressWebsiteV1($username, $domain, $wordPressV1InstallationsImportWordPressRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->importWordPressWebsiteV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string
domain string Domain name
wordPressV1InstallationsImportWordPressRequest \Hostinger\Model\WordPressV1InstallationsImportWordPressRequest

Return type

\Hostinger\Model\CommonSuccessEmptyResource

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

installWordPressV1()

installWordPressV1($username, $wordPressV1InstallationsInstallWordPressRequest): \Hostinger\Model\CommonSuccessEmptyResource

Install WordPress

Install WordPress on an existing website. The website must already exist before calling this endpoint. To create a new website first, use POST /api/hosting/v1/websites and poll GET /api/hosting/v1/websites until it appears. Call GET /api/hosting/v1/wordpress/installations filtered by username and domain before proceeding to check whether WordPress is already installed on the target domain/path. If WordPress already exists and overwrite is false (the default), the async job will fail. This operation is asynchronous: a successful response only means the install job has been queued, not that WordPress is ready. Installation typically takes 1-2 minutes. Poll GET /api/hosting/v1/wordpress/installations filtered by username and domain to track progress. When the installation appears in that list, WordPress is ready. Returns 422 when the account already uses all the databases its plan allows, unless database.name is an existing database on the account.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string
$wordPressV1InstallationsInstallWordPressRequest = new \Hostinger\Model\WordPressV1InstallationsInstallWordPressRequest(); // \Hostinger\Model\WordPressV1InstallationsInstallWordPressRequest

try {
    $result = $apiInstance->installWordPressV1($username, $wordPressV1InstallationsInstallWordPressRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->installWordPressV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string
wordPressV1InstallationsInstallWordPressRequest \Hostinger\Model\WordPressV1InstallationsInstallWordPressRequest

Return type

\Hostinger\Model\CommonSuccessEmptyResource

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

listAvailableWordPressCoreUpdatesV1()

listAvailableWordPressCoreUpdatesV1($username, $software): \Hostinger\Model\WordPressV1InstallationsUpdateResource[]

List available WordPress core updates

List available WordPress core updates for the specified installation. Provide the WordPress installation (software) identifier in the path. It can be obtained from GET /api/hosting/v1/wordpress/installations (the id field).

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string
$software = 1232456789; // string | WordPress installation (software) identifier

try {
    $result = $apiInstance->listAvailableWordPressCoreUpdatesV1($username, $software);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->listAvailableWordPressCoreUpdatesV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string
software string WordPress installation (software) identifier

Return type

\Hostinger\Model\WordPressV1InstallationsUpdateResource[]

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

listWordPressInstallationsV1()

listWordPressInstallationsV1($username, $domain, $ownership): \Hostinger\Model\WordPressV1InstallationsWordPressInstallationResource[]

List WordPress installations

List WordPress installations accessible to the authenticated client. Use this endpoint to discover existing WordPress installations and to poll for installation status after calling the install endpoint. When a newly requested installation appears in this list, WordPress is ready. Filter by username and domain to narrow results to a specific website. Each installation includes a valid flag and, when invalid, a validationError describing why.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = cl_user123; // string | Filter by specific username
$domain = example.com; // string | Filter by domain name (case-insensitive substring match)
$ownership = owned; // string | Filter by ownership type. Defaults to \"owned\". Use \"all\" to include both owned and managed installations.

try {
    $result = $apiInstance->listWordPressInstallationsV1($username, $domain, $ownership);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->listWordPressInstallationsV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string Filter by specific username [optional]
domain string Filter by domain name (case-insensitive substring match) [optional]
ownership string Filter by ownership type. Defaults to &quot;owned&quot;. Use &quot;all&quot; to include both owned and managed installations. [optional]

Return type

\Hostinger\Model\WordPressV1InstallationsWordPressInstallationResource[]

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

showWordPressCoreVersionV1()

showWordPressCoreVersionV1($username, $software): \Hostinger\Model\WordPressV1InstallationsVersionResource

Show WordPress core version

Show the WordPress core version for the specified installation, along with known vulnerabilities affecting it. Provide the WordPress installation (software) identifier in the path. It can be obtained from GET /api/hosting/v1/wordpress/installations (the id field).

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string
$software = 1232456789; // string | WordPress installation (software) identifier

try {
    $result = $apiInstance->showWordPressCoreVersionV1($username, $software);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->showWordPressCoreVersionV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string
software string WordPress installation (software) identifier

Return type

\Hostinger\Model\WordPressV1InstallationsVersionResource

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

updateWordPressCoreV1()

updateWordPressCoreV1($username, $software, $wordPressV1InstallationsUpdateInstallationRequest): \Hostinger\Model\CommonSuccessEmptyResource

Update WordPress core

Update the WordPress core for the specified installation (minor update or a specific version). Provide the WordPress installation (software) identifier in the path. It can be obtained from GET /api/hosting/v1/wordpress/installations (the id field). This operation is asynchronous: a successful response only means the update job has been queued.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\WordPressInstallationsApi(config: $config);
$username = u123456789; // string
$software = 1232456789; // string | WordPress installation (software) identifier
$wordPressV1InstallationsUpdateInstallationRequest = new \Hostinger\Model\WordPressV1InstallationsUpdateInstallationRequest(); // \Hostinger\Model\WordPressV1InstallationsUpdateInstallationRequest

try {
    $result = $apiInstance->updateWordPressCoreV1($username, $software, $wordPressV1InstallationsUpdateInstallationRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WordPressInstallationsApi->updateWordPressCoreV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
username string
software string WordPress installation (software) identifier
wordPressV1InstallationsUpdateInstallationRequest \Hostinger\Model\WordPressV1InstallationsUpdateInstallationRequest

Return type

\Hostinger\Model\CommonSuccessEmptyResource

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