Create firewall rule
curl --request POST \
--url https://rdp.sh/api/v1/servers/{server}/firewall \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"proto": "<string>",
"dport": "<string>",
"sport": "<string>",
"source": "<string>",
"dest": "<string>",
"comment": "<string>",
"enable": true
}
'import requests
url = "https://rdp.sh/api/v1/servers/{server}/firewall"
payload = {
"proto": "<string>",
"dport": "<string>",
"sport": "<string>",
"source": "<string>",
"dest": "<string>",
"comment": "<string>",
"enable": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
proto: '<string>',
dport: '<string>',
sport: '<string>',
source: '<string>',
dest: '<string>',
comment: '<string>',
enable: true
})
};
fetch('https://rdp.sh/api/v1/servers/{server}/firewall', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://rdp.sh/api/v1/servers/{server}/firewall",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'proto' => '<string>',
'dport' => '<string>',
'sport' => '<string>',
'source' => '<string>',
'dest' => '<string>',
'comment' => '<string>',
'enable' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rdp.sh/api/v1/servers/{server}/firewall"
payload := strings.NewReader("{\n \"proto\": \"<string>\",\n \"dport\": \"<string>\",\n \"sport\": \"<string>\",\n \"source\": \"<string>\",\n \"dest\": \"<string>\",\n \"comment\": \"<string>\",\n \"enable\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rdp.sh/api/v1/servers/{server}/firewall")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"proto\": \"<string>\",\n \"dport\": \"<string>\",\n \"sport\": \"<string>\",\n \"source\": \"<string>\",\n \"dest\": \"<string>\",\n \"comment\": \"<string>\",\n \"enable\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rdp.sh/api/v1/servers/{server}/firewall")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"proto\": \"<string>\",\n \"dport\": \"<string>\",\n \"sport\": \"<string>\",\n \"source\": \"<string>\",\n \"dest\": \"<string>\",\n \"comment\": \"<string>\",\n \"enable\": true\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "<string>"
}Servers
Create Firewall Rule
Create a new firewall rule for the server.
POST
/
servers
/
{server}
/
firewall
Create firewall rule
curl --request POST \
--url https://rdp.sh/api/v1/servers/{server}/firewall \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"proto": "<string>",
"dport": "<string>",
"sport": "<string>",
"source": "<string>",
"dest": "<string>",
"comment": "<string>",
"enable": true
}
'import requests
url = "https://rdp.sh/api/v1/servers/{server}/firewall"
payload = {
"proto": "<string>",
"dport": "<string>",
"sport": "<string>",
"source": "<string>",
"dest": "<string>",
"comment": "<string>",
"enable": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
proto: '<string>',
dport: '<string>',
sport: '<string>',
source: '<string>',
dest: '<string>',
comment: '<string>',
enable: true
})
};
fetch('https://rdp.sh/api/v1/servers/{server}/firewall', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://rdp.sh/api/v1/servers/{server}/firewall",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'proto' => '<string>',
'dport' => '<string>',
'sport' => '<string>',
'source' => '<string>',
'dest' => '<string>',
'comment' => '<string>',
'enable' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rdp.sh/api/v1/servers/{server}/firewall"
payload := strings.NewReader("{\n \"proto\": \"<string>\",\n \"dport\": \"<string>\",\n \"sport\": \"<string>\",\n \"source\": \"<string>\",\n \"dest\": \"<string>\",\n \"comment\": \"<string>\",\n \"enable\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rdp.sh/api/v1/servers/{server}/firewall")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"proto\": \"<string>\",\n \"dport\": \"<string>\",\n \"sport\": \"<string>\",\n \"source\": \"<string>\",\n \"dest\": \"<string>\",\n \"comment\": \"<string>\",\n \"enable\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rdp.sh/api/v1/servers/{server}/firewall")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"proto\": \"<string>\",\n \"dport\": \"<string>\",\n \"sport\": \"<string>\",\n \"source\": \"<string>\",\n \"dest\": \"<string>\",\n \"comment\": \"<string>\",\n \"enable\": true\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "<string>"
}Authorizations
Path Parameters
Body
application/json
Rule action
Available options:
ACCEPT, DROP, REJECT Traffic direction
Available options:
in, out Protocol (tcp, udp, icmp, etc.)
Destination port(s)
Source port(s)
Source IP/CIDR
Destination IP/CIDR
Rule comment
Maximum string length:
255Whether rule is enabled
⌘I