Create server API

Unfortunately not all the documentation is online. Therefore I have some trouble with the API.
The only thing I want to do is creating a new virtual server with a certain pre-configured package with help of the API.

Can someone give an example? I would be very grateful.

Thanks in advance.

Sorry for the inconvenience, Mike. API docs are coming back online tomorrow sometime.

But, note that all API docs are available in the product itself, as well (that’s where we generate the online version from).

virtualmin --help

Lists all available commands.


virtualmin create-domain --help

Will get you all the options for the create-domain command.

The remote version is identical, but you wrap up the options differently:


If you just request remote.cgi with no query string it’ll serve up a help text.

It’s all pretty discoverable if you know where to look. (But without docs, I know it’s not obvious where to look!)

Unfortunately I am still struggling with the API. This is what I have got so far:

$result = shell_exec(“wget -O - --quiet --http-user=root --http-passwd=pass --no-check-certificate https://www.domain.tld:10000/virtual-server/remote.cgi?program=create-domain&’”);

Do I attached too little variables or is the problem something else?

Thanks in advance.

What errors are you getting?

None :-S

If you try it from the command line with the exact same options (running as root), do you get anything sensible?

I did not thought of that. Thanks :slight_smile:

Now I have something that works in the command-line, but I have no idea how I can use this in PHP.
The command-line is:
virtualmin create-domain --domain --pass 123 --default-features --plan “Klein”

And what I have tried in PHP is:
$result = shell_exec(“wget -O - --quiet --http-user=root --http-passwd=pass --no-check-certificate https://www.domain.tld:10000/virtual-server/remote.cgi?program=create-domain&’”);

Can somebody please help me. Thanks in advance!

So, take it another step forward in debugging…try running the wget command (without --quiet) from the command line. It seems like any errors are disappearing somewhere, and I don’t know enough about PHP to tell you how to troubleshoot.


wget -O - --http-user=root --http-passwd=pass --no-check-certificate https://www.domain.tld:10000/virtual-server/remote.cgi?program=create-domain\&\&pass=123\&default-features\&plan=Small