Servers

Manage your servers.

Get

HTTP Request

	GET https://serverwand.com/api/servers/

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true,
    "items": [
        {
            "id": "1",
            "name": "my server",
            "hostname": "acme.com",
            "dns": "linode"
        }
    ]
}



Create

HTTP Request

	POST https://serverwand.com/api/servers/create

Parameters

Parameter Value Description
Required
provider string
dns string
name string
host string
user string
pass string
port string
region string
type string

Sample Code

	<?php
			$data = [
    "provider"=> "custom",
    "dns"=> "custom",
    "name"=> "new server",
    "host"=> "domain.com",
    "user"=> "root",
    "pass"=> "password",
    "port"=> "22",
    "region"=> "",
    "type"=> ""
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/create");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true,
    "items": [
        {
            "id": "1"
        }
    ]
}



Install

HTTP Request

	GET https://serverwand.com/api/servers/$server_id/install

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/install");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	id: 1
data: {
data: "message": "done",
data: "id": 1
data: }



Summary

HTTP Request

	GET https://serverwand.com/api/servers/{$server_id}/summary

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/{$server_id}/summary");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true,
    "item": [
        {
            "name": "my server",
            "dns": "linode",
            "hostname": "acme.com",
            "ip": "1.1.1.1",
            "ipv6": "",
            "location": "london",
            "user": "1",
            "port": "21",
            "webserver": "1",
            "disk_space": "1000",
            "disk_free": "24",
            "disk_total": "1024",
            "mem_total": "512",
            "mem_free": "32",
            "kernel": "1.1",
            "cpu": "8",
            "cores": "32",
            "uptime": "1 hour",
            "php": "7.1",
            "apache": "2.3",
            "mariadb": "5.6",
            "updates": "0",
            "security_updates": "0"
        }
    ]
}



Update

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/update

Parameters

Parameter Value Description
Required
name string
dns string

Sample Code

	<?php
			$data = [
    "name"=> "new server name",
    "dns"=> "linode"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/update");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Hostname

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/hostname

Parameters

Parameter Value Description
Required
hostname string

Sample Code

	<?php
			$data = [
    "hostname"=> "mydomain.com"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/hostname");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Reset key

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/hostname

Parameters

Parameter Value Description
Required
user string
pass string

Sample Code

	<?php
			$data = [
    "user"=> "root",
    "pass"=> "password"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/hostname");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Cron jobs

HTTP Request

	GET https://serverwand.com/api/servers/$server_id/cronjobs

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/cronjobs");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true,
    "name": "my server",
    "dns": "custom",
    "host": "domain.com",
    "ip": "0.0.0.0",
    "user": "serverwand",
    "port": "22",
    "cronjobs": {
        "line": "1",
        "command": "whoami",
        "user": "root",
        "minute": "0",
        "hour": "*",
        "dom": "*",
        "mon": "*",
        "dow": "*"
    }
}



Save Cron Job

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/savecronjob

Parameters

Parameter Value Description
Required
minute string
hour string
dom string
mon string
dow string
user string
command string

Sample Code

	<?php
			$data = [
    "minute"=> "0",
    "hour"=> "*",
    "dom"=> "*",
    "mon"=> "*",
    "dow"=> "*",
    "user"=> "root",
    "command"=> "whoami"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/savecronjob");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Delete Cron Job

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/deletecronjob

Parameters

Parameter Value Description
Required
line string

Sample Code

	<?php
			$data = [
    "line"=> "1"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/deletecronjob");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



System users

HTTP Request

	GET https://serverwand.com/api/servers/$server_id/systemusers

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/systemusers");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true,
    "name": "my server",
    "dns": "custom",
    "host": "domain.com",
    "ip": "0.0.0.0",
    "user": "serverwand",
    "port": "22",
    "users": {
        "name": "example-user"
    }
}



Save System User

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/savesystemuser

Parameters

Parameter Value Description
Required
user string
pass string

Sample Code

	<?php
			$data = [
    "user"=> "example-user",
    "pass"=> "password"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/savesystemuser");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Delete System User

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/deletesystemuser

Parameters

Parameter Value Description
Required
user string

Sample Code

	<?php
			$data = [
    "user"=> "example-user"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/deletesystemuser");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Firewall

HTTP Request

	GET https://serverwand.com/api/servers/$server_id/firewall

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/firewall");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true,
    "active": true,
    "rules": {
        "id": "1",
        "port": "25",
        "protocol": "tcp",
        "v6": "",
        "action": "allow",
        "from": "any"
    }
}



Toggle Firewall

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/savesystemuser

Parameters

Parameter Value Description
Required
status integer

Sample Code

	<?php
			$data = [
    "status"=> 1
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/savesystemuser");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Save Firewall Rule

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/savefirewallrule

Parameters

Parameter Value Description
Required
action string
from string
port string
protocol string

Sample Code

	<?php
			$data = [
    "action"=> "allow",
    "from"=> "any",
    "port"=> "25",
    "protocol"=> "tcp"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/savefirewallrule");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Delete Firewall Rule

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/deletefirewallrule

Parameters

Parameter Value Description
Required
id string

Sample Code

	<?php
			$data = [
    "id"=> "1"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/deletefirewallrule");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Fetchlog

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/fetchlog

Parameters

Parameter Value Description
Required
log string

Sample Code

	<?php
			$data = [
    "log"=> "auth"
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/fetchlog");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Messages

HTTP Request

	GET https://serverwand.com/api/servers/$server_id/messages

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/messages");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true,
    "messages": {
        "id": "1",
        "size": "100",
        "date": "2019-01-01 23:00:00",
        "sender": "example@example.org",
        "recipient": "example@example.org"
    }
}



Delete Messages

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/deletemessages

Parameters

Parameter Value Description
Required
ids array

Sample Code

	<?php
			$data = [
    "ids"=> [
        "1"
    ]
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/deletemessages");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Backups

HTTP Request

	GET https://serverwand.com/api/servers/$server_id/backups

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/backups");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true,
    "items": {
        "name": "1.zip",
        "size": "100"
    }
}



Delete Backup

HTTP Request

	POST https://serverwand.com/api/servers/$server_id/deletebackup

Parameters

Parameter Value Description
Required
ids array

Sample Code

	<?php
			$data = [
    "ids"=> [
        "1.zip"
    ]
]
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/$server_id/deletebackup");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

			curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

			// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}



Delete

HTTP Request

	GET https://serverwand.com/api/servers/{$server_id}/delete

Sample Code

	<?php
	
	$api_key = 'YOUR_API_KEY';

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://serverwand.com/api/servers/{$server_id}/delete");
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer ' . $api_key
	]);

		// receive server response
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$result = curl_exec($ch);
	curl_close ($ch);

	print_r($result);



Sample Response

	{
    "success": true
}