An API (Application Programming Interface) is a program that allows different applications to communicate with each other to share information and functionalities.
In this sense, our API allows you to manage everything you can do in the Clouding panel. From creating servers from different sources, to archiving/unarchiving, creating snapshots, activating backups, adding firewall rules, etc.
For this tutorial we will use the CURL command but we can also use a client for APIs called HTTPie in its CLI and graphical version. And, in addition, you can use any other API client (PostMan (Linux, Windows, Mac), RapidAPI (Mac), etc.).
Refer to the official Clouding API documentation
We recommend that to follow this article and for more information you consult the official Clouding API documentation for more details.
Here is the section where you can read about resizing a server.
You will see that there will be an endpoint where you will have to indicate the server ID and later some parameters to indicate the flavor and the size of the disk.
To obtain the list of servers where the server ID will appear you can execute the following:
curl -X GET -H "Content-Type: application/json" -H "X-API-KEY: $CLOUDING_APIKEY" https://api.clouding.io/v1/servers
This will show you in JSON format all the servers you have:
...
{
"id": "58XEgdA0JVQ26mA0",
"name": "TutorialAPI",
"hostname": "test",
"vCores": 0.5,
"ramGb": 1,
"flavor": "0.5x1",
"volumeSizeGb": 5,
"image": {
"id": "BJebl0d7zA2WGwQ1",
"name": "Debian 11 (64 Bit)"
},
...
If you look at the JSON output, you will see that you have the id, which you should use for resizing; and that the server configuration is 0.5 vcores, 1GB RAM and 5GB SSD. You will also see that the flavor is 0.5x1.
As an example, let's resize this server to the top flavor 1x2 (1vcore + 2GB RAM). To do this we will run the following command:
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: $CLOUDING_APIKEY" -d '{"flavorId":"1x2", "volumeSizeGb":"5"}' https://api.clouding.io/v1/servers/$ID/resize
Remember to change $CLOUDING_APIKEY and $ID to the correct values.
Launching this command will start the server resizing:
And this is the output of the command in JSON format:
{
"id": "LQbN5nvQovrK9Jae",
"status": "inProgress",
"type": "resize",
"startedAt": "2023-02-17T10:20:52.6601832Z",
"completedAt": null,
"resourceId": "58XEgdA0JVQ26mA0",
"resourceType": "server"
}
You can also resize the server by modifying only the disk in this way:
curl -X POST -H "Content-Type: application/json" -H "X-API-KEY: $CLOUDING_APIKEY" -d '{"volumeSizeGb":"50"}' https://a