HostingRaja API Developer Document

Essentials of launching your Cloud Office startup with this comprehensive tutorial. Hosted by HostingRaja.

HostingRaja API Developer Document

HostingRaja offers an API service that allows you to easily create cloud servers. However, before you can use our API service, you'll need to pay a security deposit of Rs. 1000/- from your client area dashboard. Once you've completed the payment, you can start creating cloud servers through our API, making it quick and easy to manage your cloud infrastructure. With our API service, you can easily scale your cloud servers up or down, add or remove resources, and much more, all from a simple and intuitive interface.


To generate API keys for accessing our API services, please follow these steps:

1) Log in to your client area using your HostingRaja credentials.

2) From the left-side menu, click on the "API" option.

3) Click on the button provided to generate a payment link for making a security deposit.


4) Once you click the button to pay the security deposit, a payment link will be generated. You can then proceed to complete the payment by clicking on the link provided.



5) To access our API, you need to whitelist your IP address by providing a comma-separated list of your IP addresses.

.Once you generated the authorization token & secret key. You need to whitelist your IP address separated by comma to access our API

Note : Please note that if you do not whitelist your IP address using the above steps, you will not be able to connect to our API

Authentication

You have to pass your auth token & secret key to each API request. For that use the below post request method for all API.


Post Request :


Parameter Type Description Required
auth_key string Your API Auth Token Required
secret_key string Your secret Key Required


Example Request (CURL):

curl -X POST \
-H "Content-Type: application/json" \
-d ' {
"auth_token": "YOUT_AUTH_TOKEN",
"secret_key": "YOUR_SECRET_KEY"
}' \

Get Available Images

This API will provide a list of Operating Systems that we offer for creating Cloud Servers.

Post Request :

Parameter Type Description Required
request string get Available Images Required

Example Request (CURL):

curl  -X POST \
  -H "Content-Type: application/json" \
  -d '{
       "request ": "getAvailableImage"
  }' \ 


:Response Format

.The API will respond with JSON data

Example response data:

{
   "status": "success",
   "available_image":
       {
 "centos7": "CentOS-7-x64", 
 "centos7": "CentOS-7-x64-cPanel",
  } 
}


:Create Server

The Cloud deployment API streamlines the process of setting up and managing your Cloud infrastructure. It's fast, flexible, and secure, with built-in scalability and redundancy features. Whether you're deploying a small or large-scale Cloud environment, the Cloud deployment API makes it easy to get started and achieve your goals.

Post Request :


Parameter Type Description
request string CreateVM
hostname string Hostname for server
configuration

array[]

Configuration Data in array, by passing below elements
ram int Maximum 128 GB RAM for passing configuration array elements
disk int Configuration array requires 40-1024 GB disk space.
cpu int Max 16 CPU cores for configuration array
bandwidth int Max 10 TB bandwidth for config array.
managed_support true/false Managed Support. Default will be false.
image string Output OS key name from "getAvailableImage"


Example Request (CURL):

curl -X POST \
-H "Content-Type: application/json" \
-d '{ "request": "CreateVM",

"data": {

"hostname":
"YOUR_HOST_NAME",
"configuration": {
"ram": 2,
"cpu": 1,
"disk": 50,

"bandwidth": 2,

"image":
"ubuntu",

“scaling” :
“vertical”

},

“Managed_support” : true

}
}' \

Response Format:

The API will respond with JSON data.

Example response data:



{
"status": "success",
"vmid": "1234",
"message":
"Server creation initiated successfully. You will get credentials shortly."

}


Get My Servers

This API returns a list of servers that were created using the API request.

Post Request :

Parameter Type Description Required
request string getMyServers Required
product_id int To get Specific server Required


Example Request (CURL):
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"request": "getMyServers",

“data”
‘{
“product_id” : 1234
}’\
}' \

Response Format:
The API will respond with JSON data.
Example response data:

{
"status": "success",
"Data" :
{
“product_id1” :
{
“product_id” : 1234,
“hostname” : “example1.com”,
“product_status” : “Active”,
“created_on” : “2023-02-24”,
“expired_on” : “2023-03-24”,
“plan_name” : “Custom Cloud Server”,
“configuration” : {
“image” : “Windows 2019”,
“ram” : “10 GB”,
“core” : “10 Core”,
“disk” : “500 GB”,
“band” : “1 TB”
},
“current_status” : “Current Server status as per API request”,
},
“product_id2”
{
“product_id” : 4567,
“hostname” : “example2.com”,
“product_status” : “Product Status of HostingRaja”,
“created_on” : “2023-02-24”,
“expired_on” : “2023-03-24”,
“plan_name” : “Custom Cloud Server”,

“configuration” : {
“image” : “Windows 2019”,
“ram” : “10 GB”,
“core” : “10 Core”,
“disk” : “500 GB”,
“band” : “1 TB”
}
“Addons” :
{
“addon_id1” :
{
“addon_id1”: “1234”,
“addon_name” : “Managed Support”,
“”recurring” : “500”,
“billingcycle” : “Monthly”,
“regdate” : “2023-02-25”,
“nextduedate” : “2023-03-25”
}
},
“current_status” : “Current Server status as per API request”,
}
}
}

getMaxServerCount

This API allocates a specified number of servers for creation, with a maximum limit of 10.

Post Request :

Parameter Type Description Required
request string startServer Required
product_id int Product id to be start Required

Example Request (CURL):

curl -X POST \
-H "Content-Type: application/json"
-d '{
"request ": "getMaxServerCount"
}' \

Response Format:

The API will respond with JSON data.

Example response data:

{
"status": "success",
"count": “count in number”
}

stopServer

With this API, you can initiate a server stop action to gracefully shut down your server. This API ensures that all processes are terminated and any pending data is saved before shutting down the server.

Post Request :

Parameter Type Description Required
request string stopServer Required
product_id int Product id to be stop Required

Example Request (CURL):
curl -X POST \
-H "Content-Type: application/json"
-d '{
"request ": "stopServer"
“data” ‘{
"product_id": "1234",
}’

}' \

Response Format:

The API will respond with JSON data.

Example response data:

{
"status": "success"
}

startServer

This API allows you to start your server after it has been stopped or shut down. The API initiates the boot process of the server, allowing it to become operational again.

Post Request :

Parameter Type Description Required
request string startServer Required
product_id int Product id to be start Required

Example Request (CURL)

curl -X POST \
-H "Content-Type: application/json"
-d '{
"request ": "startServer"
“data” ‘{
"product_id": "1234",
}’

}' \

Response Format:

The API will respond with JSON data.

Example response data:

{
"status": "success"
}

rebootServer

Use this API to initiate a server reboot. When you reboot your server, it shuts down and then automatically starts back up, allowing any pending updates or changes to take effect.

Post Request :


Parameter Type Description Required
request string rebootServer Required
product_id int Product id to be stop Required

Example Request (CURL)

curl -X POST \
-H "Content-Type: application/json"
-d '{
"request ": "rebootServer"
“data” ‘{
"product_id": "1234",
}’

}' \

Response Format:

The API will respond with JSON data.

Example response data:

{
"status": "success"
}

suspendServer

This API initiates a server suspension action, which saves the current state of the server and stops all processes, allowing you to temporarily halt your server. When you're ready to resume operations, you can use the start API to boot the server backup and restore its state to the point of suspension.

Post Request :

Parameter Type Description Required
request string suspendServer Required
product_id int

Product id to be suspend

Required

Example Request (CURL)

curl -X POST \
-H "Content-Type: application/json"
-d '{
"request ": "suspendServer"
“data” ‘{
"product_id": "1234",
}’

}' \

Response Format:

The API will respond with JSON data.

Example response data:

{
"status": "success"
}

unsuspendServer

Use this API to unsuspend your server.

When a server is suspended, it is in a halted state, and all processes are stopped. Using the unsuspend API initiates the process of resuming the server, allowing you to restore the state of the server to the point at which it was suspended.

Post Request :

Parameter Type Description Required
request string unsuspendServer Required
product_id int

Product id to be un suspend

Required

Example Request (CURL)

curl -X POST \
-H "Content-Type: application/json"
-d '{
"request ": "unsuspendServer"
“data” ‘{
"product_id": "1234",
}’

}' \

Response Format:

The API will respond with JSON data.

Example response data:

{
"status": "success"
}

terminateServer

This API allows you to initiate a server termination action, which permanently deletes the server and all associated data. It is an irreversible action, so be sure to take any necessary backups or data exports before proceeding with the termination.

Post Request :

Parameter Type Description Required
request string terminateServer Required
product_id int Product id to be delete Required

Example Request (CURL)

curl -X POST \
-H "Content-Type: application/json"
-d '{
"request ": "terminateServer"
“data” ‘{
"product_id": "1234",
}’

}' \

Response Format:

The API will respond with JSON data.

Example response data:

{
"status": "success"
}

Recreate Server

This API will be used to recreate your server. It will delete the current server and create a new server with the same configuration.

So make sure that you have taken backup of the current server, before proceeding with the recreate server.

Post Request :

Parameter Type Description Required
request string recreateServer Required
product_id int Product id to be recreate Required

Example Request (CURL):

curl -X POST \
-H "Content-Type: application/json"
-d '{
"request ": "recreateServer"
“data”
‘{

"product_id": "1234",

}’


}' \

Response Format:

The API will respond with JSON data.

Example response data:

{
"status": "success"
}