Skip to main content

resource_websites

Creates, updates, deletes, gets or lists a resource_websites resource.

Overview​

Nameresource_websites
TypeResource
Idovh.managed_cms.resource_websites

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Unique identifier of the website
checksumstringComputed hash used to control concurrent modification requests
current_stateobjectCurrent state of the website (wire: currentState)
current_tasksarrayOngoing asynchronous tasks related to the website (wire: currentTasks)
resource_statusstringWebsite readiness in the system (CREATING, CREATION_PLANNED, DELETING, ERROR, OUT_OF_SYNC, READY, SUSPENDED, UNKNOWN, UPDATING) (wire: resourceStatus)
target_specobjectTarget specification of the website (wire: targetSpec)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_id, website_idReturns the CMS and PHP versions, domains, SFTP and database access, disk usage and planned update of the website. (Alpha version)
listselectservice_idx_pagination_cursor, x_pagination_sizeReturns the websites of the service. (Alpha version)
createinsertservice_id, target_specCreates a WordPress website, imports one from its admin URL and credentials, or clones a website of the same service. The admin login of a created website must be an email address. Creation is asynchronous: follow its task in currentTasks. (Alpha version)
updateupdateservice_id, website_idUpdates the domains, primary FQDN or planned update of the website. It can also flush its CDN, or reset its database, SFTP or PhpMyAdmin password. (Alpha version)
deletedeleteservice_id, website_idPermanently deletes the website, with its files and database. (Alpha version)
application_passwordexecserviceId, websiteIdEach call creates a new application password on the existing administrator user. The previous ones stay valid. They can be revoked from the CMS administration. (Beta version)
flush_cdnexecserviceId, websiteIdFlushes the CDN cache of the website and returns the task. (Alpha version)
reset_database_passwordexecserviceId, websiteIdGenerates a new database password and sets it on the database and in the WordPress configuration. Use it to revoke a leaked password: the new password is not returned. (Alpha version)
reset_php_my_admin_passwordexecserviceId, websiteId, passwordSets a new PhpMyAdmin password for the website and returns the task. The password needs 9 to 30 alphanumeric characters, with at least one uppercase letter, one lowercase letter and one digit. (Alpha version)
reset_sftp_passwordexecserviceId, websiteId, passwordSets a new SFTP password for the website and returns the task. The password needs 9 to 30 alphanumeric characters, with at least one uppercase letter, one lowercase letter and one digit. (Alpha version)
snapshotexecserviceId, websiteIdExports a full backup of the website, files and database, and returns the task. The download links are sent by email. (Alpha version)

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
serviceIdstring (uuid)Service ID
service_idstring (uuid)Service ID (wire: serviceId)
websiteIdstring (uuid)Website ID
website_idstring (uuid)Website ID (wire: websiteId)
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the CMS and PHP versions, domains, SFTP and database access, disk usage and planned update of the website. (Alpha version)

SELECT
id,
checksum,
current_state,
current_tasks,
resource_status,
target_spec
FROM ovh.managed_cms.resource_websites
WHERE service_id = '{{ service_id }}' -- required
AND website_id = '{{ website_id }}' -- required
;

INSERT examples​

Creates a WordPress website, imports one from its admin URL and credentials, or clones a website of the same service. The admin login of a created website must be an email address. Creation is asynchronous: follow its task in currentTasks. (Alpha version)

INSERT INTO ovh.managed_cms.resource_websites (
target_spec,
service_id
)
SELECT
'{{ target_spec }}' /* required */,
'{{ service_id }}'
RETURNING
id,
checksum,
current_state,
current_tasks,
resource_status,
target_spec
;

UPDATE examples​

Updates the domains, primary FQDN or planned update of the website. It can also flush its CDN, or reset its database, SFTP or PhpMyAdmin password. (Alpha version)

UPDATE ovh.managed_cms.resource_websites
SET
target_spec = '{{ target_spec }}'
WHERE
service_id = '{{ service_id }}' --required
AND website_id = '{{ website_id }}' --required
RETURNING
id,
checksum,
current_state,
current_tasks,
resource_status,
target_spec;

DELETE examples​

Permanently deletes the website, with its files and database. (Alpha version)

DELETE FROM ovh.managed_cms.resource_websites
WHERE service_id = '{{ service_id }}' --required
AND website_id = '{{ website_id }}' --required
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Each call creates a new application password on the existing administrator user. The previous ones stay valid. They can be revoked from the CMS administration. (Beta version)

EXEC ovh.managed_cms.resource_websites.application_password
@serviceId='{{ serviceId }}' --required,
@websiteId='{{ websiteId }}' --required
;