How to create and manage a web application using the OVHcloud public API (EN)

Bases de conocimiento

How to create and manage a web application using the OVHcloud public API (EN)


Icons/System/eye-open Created with Sketch. 132 visualizaciones 05.09.2024 Web / Alojamiento web

Objective

This guide explains how to use the OVHcloud public API to create and manage a web application on your hosting plan. You will learn how to perform key operations such as attaching domains, managing databases, and configuring SSL certificates.

Requirements

Using OVHcloud APIs requires advanced knowledge in this field. If you experience any difficulties, please contact the OVHcloud partners.

Instructions

Retrieving service information

The first step is to retrieve the serviceName, a unique ID for your web hosting service. You will need it for most of the following API calls.

This command returns a list of your web hosting services. Each entry in the list is a serviceName.

Return example :

[
  "example.cluster01.hosting.ovh.net",
  "example2.cluster02.hosting.ovh.net"
]

Attaching a domain

Attach a domain to your web hosting service:

SettingsRequiredDescription
serviceNameyesService name
bypassDNSConfigurationnoIf enabled, the DNS zone will not be updated
cdnnoIndicates whether the domain is linked to the hosting CDN. Allowed values: active┃none
domainnoDomain to link
firewallnoIndicates whether the firewall is active for this domain. Allowed values : active┃none
ipLocationnoSets the IP location associated with the domain. Allowed values : BE┃CA┃CZ┃DE┃ES┃FI┃FR┃IE┃IT┃LT┃NL┃PL┃PT┃UK
ownLognoDomain to separate logs
pathnoPath where web files will be stored
runtimeIdnoRuntime configuration ID used on this domain
sslnoOption to activate SSL for the domain

Return example :

{
 "doneDate": "2024-08-22T08:13:50.740Z",
 "function": "abuse/close",
 "id": 0,
 "lastUpdate": "2024-08-22T08:13:50.740Z",
 "objectId": "string",
 "objectType": "Abuse",
 "startDate": "2024-08-22T08:13:50.740Z",
 "status": "cancelled"
}

Generating SSL certificates

Configure and manage SSL certificates to secure your website:

SettingsRequiredDescription
serviceNameyesService name
certificatenoSSL certificate to install
chainnoCertificate chain used to validate SSL certificate
keynoPrivate key associated with the SSL certificate

Return example :

{
 "isReportable": false,
 "provider": "COMODO",
 "regenerable": false,
 "status": "created",
 "taskId": 0,
 "type": "CUSTOM"
}

Managing databases

With the OVHcloud Web Hosting APIs, you can also manage your databases.

Creating a database

SettingsRequiredDescription
serviceNameyesService name
capacityyesDB Capabilities. Values: extraSqlPersonal┃local┃privateDatabase┃sqlLocal┃sqlPersonal┃sqlPro
useryesDatabase username. Must be lowercase and start with your web hosting ID
passwordnoDB password
quotanoSpace allocated. Values: 25┃100┃200┃256┃400┃512┃800┃1024
typeyesDB type. Values: mariadb┃mysql┃postgresql┃redis
versionnoDB version

Return example :

{
"doneDate": "2024-08-22T09:24:35.206Z",
"function": "string",
"id": 0,
"lastUpdate": "2024-08-22T09:24:35.206Z",
"objectId": "string",
"objectType": "Abuse",
"startDate": "2024-08-22T09:24:35.206Z",
"status": "cancelled"
}

Listing existing databases

List all the databases associated with your web hosting service:

SettingsRequiredDescription
serviceNameyesService name
modeyesAllowed values: besteffort ┃ classic ┃ module

Return example :

[
 "example.mysql.db",
 "example2.mysql.db"
]

Managing modules

Retrieving a list of modules

Get a list of available modules that you can install on your web hosting plan:

SettingsRequiredDescription
activenoFilter enabled or disabled modules
branchnoFilter modules by version. Allowed values: old ┃ stable ┃ testing
latestnoFilter to show modules matching the latest version

Return example :

[
 195,
 184,
 38,
 176
]

Retrieving a module's information

Get the details of a specific module installed on your web hosting plan:

SettingsRequiredDescription
idyesModule ID

Return example :

{
 "keywords": [
   "gallery"
 ],
 "adminNameType": "string",
 "author": "OVH",
 "branch": "old",
 "id": 195,
 "size": {
   "value": 0,
   "unit": "B"
 },
 "name": "myname",
 "upgradeFrom": [],
 "language": [
   "en",
   "fr",
   "de",
   "es",
   "pl"
 ],
 "version": "1.4.2.2",
 "active": false,
 "languageRequirement": {
   "value": "php",
   "unit": "supported versions: ''\nnon supported versions: '8+'"
 },
 "latest": true
}

Installing a new module

Install a new module on your web hosting service:

SettingsRequiredDescription
serviceNameyesService name
moduleIdyesModule ID to install
adminNamenoAdministrator name
adminpasswordnoAdministrator account password
domainnoDomain name where the module will be deployed
languagenoLanguage of the module installation
pathnoPath on the server where the module will be installed
dependencies -> namenoDependent service name
dependencies -> passwordnoPassword for dependent service
dependencies -> portnoService connection port
dependencies -> prefixnoPrefix used in service configuration
dependencies -> servernoServer address of the dependent service
dependencies -> typenoType of service (e.g. MySQL)
dependencies -> usernoUsername for dependent service

Return example :

{
"doneDate": "2024-08-22T09:24:35.206Z",
"function": "string",
"id": 0,
"lastUpdate": "2024-08-22T09:24:35.206Z",
"objectId": "string",
"objectType": "Abuse",
"startDate": "2024-08-22T09:24:35.206Z",
"status": "cancelled"
}

Managing FTP users

Manage FTP/SSH users on your Web Hosting plan to facilitate access and configuration.

Creating a new FTP/SSH user

Create a new FTP or SSH user to access your web hosting plan:

SettingsRequiredDescription
serviceNameyesService name
homeyesHome Directory
loginyesUsername
passwordyesPassword
sshStatenoDetermines the SSH access state for the user. Allowed values: active ┃none ┃sftponly

Return example :

{
"doneDate": "2024-08-22T09:24:35.206Z",
"function": "string",
"id": 0,
"lastUpdate": "2024-08-22T09:24:35.206Z",
"objectId": "string",
"objectType": "Abuse",
"startDate": "2024-08-22T09:24:35.206Z",
"status": "cancelled"
}

Listing FTP/SSH users

List all existing FTP/SSH users on your hosting service:

SettingsRequiredDescription
serviceNameyesService name
homenoFilter users based on their home directory
loginnoFilter users based on their user name

Return example :

[
 "user1",
 "user2",
 "user3",
 "user4"
]

Restoring a database

Create, list and restore database backups for your website.

Creating a backup of a database

Create a backup of your database to restore if necessary:

SettingsRequiredDescription
serviceNameyesService name
nameyesDatabase name
dateyesBackup type. Allowed values: daily.1┃now┃weekly.1
sendEmailnoIf this setting is enabled, an email is sent when the backup is available

Return example :

{
"doneDate": "2024-08-22T09:24:35.206Z",
"function": "string",
"id": 0,
"lastUpdate": "2024-08-22T09:24:35.206Z",
"objectId": "string",
"objectType": "Abuse",
"startDate": "2024-08-22T09:24:35.206Z",
"status": "cancelled"
}

Listing the available database backups

List all available backups for your databases:

SettingsRequiredDescription
serviceNameyesService name
nameyesDatabase name
creationDate.fromnoFilter backups created from this date
creationDate.tonoFilter backups created up to this date
deletionDate.fromnoFilter deleted backups from this date
deletionDate.tonoFilter deleted backups up to this date
typenoFilter backups by type. Allowed values: daily.1┃now┃weekly.1

Return example :

[
 1,
 12
]

Restoring a specific backup of a database

Restore a specific backup of your database if there is a problem:

SettingsRequiredDescription
serviceNameyesService name
nameyesDatabase name
idyesBackup ID

Return example :

{
"doneDate": "2024-08-22T09:24:35.206Z",
"function": "string",
"id": 0,
"lastUpdate": "2024-08-22T09:24:35.206Z",
"objectId": "string",
"objectType": "Abuse",
"startDate": "2024-08-22T09:24:35.206Z",
"status": "cancelled"
}

Conclusion

This guide has introduced you to the main API requests for managing your OVHcloud web hosting plan, such as domain attachment, SSL certificate management and database management.

However, there are many other API calls available, which you can explore depending on your specific needs. For more options and features, you can refer to the « /hosting/web » section of the OVHcloud API.

Go further

Order a domain name via API

Join our community of users.

Artículos relacionados