Skip to main content

websites

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

Overview​

Namewebsites
TypeResource
Idovh.hosting_web.websites

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idintegerWebsite numeric identifier
namestringCustomizable name of the website
hosting_display_namestringDisplay name of the hosting (wire: hostingDisplayName)
hosting_service_namestringName of the hosting service (wire: hostingServiceName)
domainsarrayDomains of the website
pathstringRelative path on the hosting filesystem the website is deployed into
statusstringCurrent status of the website (created, creating, deleting, deploying, error, initialError)
vcs_branchstringBranch of the repository containing the website source code to deploy (wire: vcsBranch)
vcs_urlstringURL of the repository containing the website source code to deploy (wire: vcsUrl)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, service_nameReturns the name, path, status, domains and repository of the website.
listselectservice_namepath, x_pagination_modeReturns the IDs of the websites of the hosting. Filter them by path.
createinsertservice_name, path, vcs_branch, vcs_urlCreates a website in a folder of the hosting, deployed from a repository branch, and returns the task.
updateupdateid, service_nameUpdates the repository branch deployed on the website.
deletedeletedelete_files, id, service_nameDeletes the website and returns the task. Set deleteFiles to true to also empty the website folder.
deployexecid, serviceNameDeploys the website from its repository branch and returns the task. Set reset to true to reset the website files before deploying.

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"}})
delete_filesbooleanWhether the website path should be emptied or not (wire: deleteFiles)
idintegerId
serviceNamestringService name
service_namestringService name (wire: serviceName)
pathstringFilter the value of path property
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Returns the name, path, status, domains and repository of the website.

SELECT
id,
name,
hosting_display_name,
hosting_service_name,
domains,
path,
status,
vcs_branch,
vcs_url
FROM ovh.hosting_web.websites
WHERE id = '{{ id }}' -- required
AND service_name = '{{ service_name }}' -- required
;

INSERT examples​

Creates a website in a folder of the hosting, deployed from a repository branch, and returns the task.

INSERT INTO ovh.hosting_web.websites (
path,
vcs_branch,
vcs_url,
service_name
)
SELECT
'{{ path }}' /* required */,
'{{ vcs_branch }}' /* required */,
'{{ vcs_url }}' /* required */,
'{{ service_name }}'
RETURNING
id,
object_id,
done_date,
function,
last_update,
object_type,
start_date,
status
;

UPDATE examples​

Updates the repository branch deployed on the website.

UPDATE ovh.hosting_web.websites
SET
vcs_branch = '{{ vcs_branch }}'
WHERE
id = '{{ id }}' --required
AND service_name = '{{ service_name }}' --required
RETURNING
id,
name,
hosting_display_name,
hosting_service_name,
domains,
path,
status,
vcs_branch,
vcs_url;

DELETE examples​

Deletes the website and returns the task. Set deleteFiles to true to also empty the website folder.

DELETE FROM ovh.hosting_web.websites
WHERE delete_files = '{{ delete_files }}' --required
AND id = '{{ id }}' --required
AND service_name = '{{ service_name }}' --required
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Deploys the website from its repository branch and returns the task. Set reset to true to reset the website files before deploying.

EXEC ovh.hosting_web.websites.deploy
@id='{{ id }}' --required,
@serviceName='{{ serviceName }}' --required
@@json=
'{
"reset": {{ reset }}
}'
;