OVHcloud Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Fetching and setting custom server name via API


#1

Hi,

I’m using https://api.ovh.com/ to interact with OVH API for bare metal machines. Currently I would like to list servers and that works via ck.add_recursive_rules(ovh.API_READ_ONLY, "/dedicated/server") [Python]. However I cannot find a way to get our custom names of the servers. API lists for example:

=====> ns<number>.ip-<xxx>-<xxx>-<xxx>.eu (<num>) <=====
{
  "bootId": 1,
  "commercialRange": "ADVANCE-2",
  "datacenter": "rbx7",
  "ip": "<xxx>.<xxx>.<xxx>.<xxx>",
  "linkSpeed": 1000,
  "monitoring": true,
  "name": "ns<number>.ip-<xxx>-<xxx>-<xxx>.eu",
  "newUpgradeSystem": true,
  "noIntervention": false,
  "os": "ubuntu1804-server_64",
  "professionalUse": false,
  "rack": "<rack-id>",
  "rescueMail": null,
  "reverse": "ns<number>.ip-<xxx>-<xxx>-<xxx>.eu",
  "rootDevice": null,
  "serverId": <server-id>,
  "state": "ok",
  "supportLevel": "pro"
}

Above there is only OVH name, but above server in OVH web UI has our own custom name andromeda123456.example.com

Is there any way to get both, internal OVH name (ns<number>.ip-<xxx>-<xxx>-<xxx>.eu) and our own custom name?

Also, be able to update / rename it via API would be great too.

Regards.


#2

Hi!
Additional info may be received here /dedicated/server/{serviceName}/serviceInfos
You need serviceId: from this request.
Then go to the /services/{serviceId} or /service/{serviceId}
If I get you right and “custom name” == “displayName”, you will find it there.


#3

Awesome! Thanks, it works like a charm.