Renewing your services via the OVHcloud API
Find out how to renew your services via the OVHcloud API
Find out how to renew your services via the OVHcloud API
Last updated 4th July 2020
Natively, OVHcloud offers you the option of renewing your solution automatically. However, you can also use OVHcloud APIs to renew your services.
This guide will explain how to proceed with this renewal process.
To use the renewal API, you will need your serviceId
. You can get this information via the serviceInfos
API, for example:
You can also use the following API to list your services:
If you want to list the different renewal strategies available for a given service, this is the API to use:
A RenewDescription
list will appear with two keys:
renewPeriod
: a renewal period (in ISO 8601 format)strategies
: a list of RenewStrategy
(renewal strategies)A RenewStrategy
contains a price and a list of services to be renewed. Renewing a domain name is one strategy; renewing a domain name and its hosting plan is another. The strategies therefore list all potential combinations for a given service: associated services, options, etc.
Below is an example in Python for retrieving renewal information:
import ovh
client = ovh.Client()
client.get('/service/12345/renew',
includeOptions=False, // Include service s option(s) (type: boolean)
)
Here is an example of a result that we can analyse, with the example being taken over a given period of time:
[
{
"renewPeriod": "P1Y",
"strategies": [
{
"services": [
12345
],
"price": {
"value": 1.99
},
"servicesDetails": [
{
"serviceType": "Domain .ovh",
"serviceId": 12345
}
]
},
{
"services": [
67890,
12345
],
"price": {
"value": 37.87
},
"servicesDetails": [
{
"serviceType": "Hosting Perso 2014",
"serviceId": 67890
},
{
"serviceType": "Domain .ovh",
"serviceId": 12345
}
]
}
]
}
]
Please refer to the renew
API for more information on the format of the result:
To create a new purchase order for a renewal, you will need to specify which services are to be renewed, and for which period:
import ovh
client = ovh.Client()
client.post('/service/12345/renew',
dryRun=False, // Indicates if renew order is generated (type: boolean)
duration='P1Y',
services=[
67890,
12345
]
)
Which will give the following response:
{
"expirationDate": "2018-05-16T15:49:06+02:00",
"password": "aBcD",
"date": "2018-05-15T15:49:06+02:00",
"priceWithTax": {
"value": 45.44,
"text": "45.44 \u20ac",
"currencyCode": "CAD"
},
"tax": {
"value": 7.57,
"text": "7.57 \u20ac",
"currencyCode": "CAD"
},
"pdfUrl": "https://www.ovh.com/cgi-bin/order/displayOrder.cgi?orderId=123456789&orderPassword=aBcD",
"orderId": 123456789,
"url": "https://www.ovh.com/cgi-bin/order/displayOrder.cgi?orderId=123456789&orderPassword=aBcD",
"priceWithoutTax": {
"value": 37.87,
"text": "37.87 \u20ac",
"currencyCode": "CAD"
},
"retractionDate": null
}
You will now be able to settle this purchase order via the order
API:
import ovh
client = ovh.Client()
myVps = "vps112233.ovh.net"
expectedRenewPeriod = "P3M"
def checkStrategy(choices, serviceId):
for choice in choices:
if choice['renewPeriod'] != expectedRenewPeriod:
continue
for strategy in choice['strategies']:
services = strategy['services']
if len(services) == 1 and serviceId in services:
return True
raise ValueError('Unable to find expected service/renewPeriod in choices')
def main():
serviceId = client.get('/vps/{}/serviceInfos'.format(myVps))['serviceId']
choices = client.get('/service/{}/renew'.format(serviceId))
checkStrategy(choices, serviceId)
order = client.post('/service/{}/renew'.format(serviceId),
dryRun=False,
duration=expectedRenewPeriod,
services=[
serviceId
]
)
client.post('/me/order/{}/payWithRegisteredPaymentMean'.format(order['orderId']),
paymentMean='paypal',
paymentMeanId=1234
)
:if __name__ == '__main__':
main()
Join our community of users on https://community.ovh.com/en/.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community