curl --location --request POST 'http://dev.fpanel.net:8880/api' \
--header 'Content-Type: application/json' \
--header 'Token;' \
--data-raw '{
"api": {
"process": "domain/dns/update",
"data": {
"domain_name": "domain.com",
"record_type": "A",
"ns_value": "ns3.domain.com",
"a_host": "test",
"a_value": "{{ip_address}}",
"cname_host": "test",
"cname_value": "test",
"mx_value": "test",
"mx_opt": "test",
"ptr_host": "test",
"ptr_value": "test",
"ptr_opt": "test",
"txt_value": "test",
"old_type": "NS",
"old_host": "domain.com",
"old_value": "ns3.domain.com"
}
}
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://dev.fpanel.net:8880/api',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"api": {
"process": "domain/dns/update",
"data": {
"domain_name": "domain.com",
"record_type": "A",
"ns_value": "ns3.domain.com",
"a_host": "test",
"a_value": "{{ip_address}}",
"cname_host": "test",
"cname_value": "test",
"mx_value": "test",
"mx_opt": "test",
"ptr_host": "test",
"ptr_value": "test",
"ptr_opt": "test",
"txt_value": "test",
"old_type": "NS",
"old_host": "domain.com",
"old_value": "ns3.domain.com"
}
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Token: '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("dev.fpanel.net", 8880)
payload = json.dumps({
"api": {
"process": "domain/dns/update",
"data": {
"domain_name": "domain.com",
"record_type": "A",
"ns_value": "ns3.domain.com",
"a_host": "test",
"a_value": "{{ip_address}}",
"cname_host": "test",
"cname_value": "test",
"mx_value": "test",
"mx_opt": "test",
"ptr_host": "test",
"ptr_value": "test",
"ptr_opt": "test",
"txt_value": "test",
"old_type": "NS",
"old_host": "domain.com",
"old_value": "ns3.domain.com"
}
}
})
headers = {
'Content-Type': 'application/json',
'Token': ''
}
conn.request("POST", "/api", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"url": "http://dev.fpanel.net:8880/api",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Token": ""
},
"data": JSON.stringify({
"api": {
"process": "domain/dns/update",
"data": {
"domain_name": "domain.com",
"record_type": "A",
"ns_value": "ns3.domain.com",
"a_host": "test",
"a_value": "{{ip_address}}",
"cname_host": "test",
"cname_value": "test",
"mx_value": "test",
"mx_opt": "test",
"ptr_host": "test",
"ptr_value": "test",
"ptr_opt": "test",
"txt_value": "test",
"old_type": "NS",
"old_host": "domain.com",
"old_value": "ns3.domain.com"
}
}
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://dev.fpanel.net:8880/api"
method := "POST"
payload := strings.NewReader(`{
"api": {
"process": "domain/dns/update",
"data": {
"domain_name": "domain.com",
"record_type": "A",
"ns_value": "ns3.domain.com",
"a_host": "test",
"a_value": "{{ip_address}}",
"cname_host": "test",
"cname_value": "test",
"mx_value": "test",
"mx_opt": "test",
"ptr_host": "test",
"ptr_value": "test",
"ptr_opt": "test",
"txt_value": "test",
"old_type": "NS",
"old_host": "domain.com",
"old_value": "ns3.domain.com"
}
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Token", "")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var client = new RestClient("http://dev.fpanel.net:8880/api");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "");
var body = @"{" + "\n" +
@" ""api"": {" + "\n" +
@" ""process"": ""domain/dns/update""," + "\n" +
@" ""data"": {" + "\n" +
@" ""domain_name"": ""domain.com""," + "\n" +
@" ""record_type"": ""A""," + "\n" +
@" " + "\n" +
@" ""ns_value"": ""ns3.domain.com""," + "\n" +
@" " + "\n" +
@" ""a_host"": ""test""," + "\n" +
@" ""a_value"": ""{{ip_address}}""," + "\n" +
@" " + "\n" +
@" ""cname_host"": ""test""," + "\n" +
@" ""cname_value"": ""test""," + "\n" +
@" " + "\n" +
@" ""mx_value"": ""test""," + "\n" +
@" ""mx_opt"": ""test""," + "\n" +
@" " + "\n" +
@" ""ptr_host"": ""test""," + "\n" +
@" ""ptr_value"": ""test""," + "\n" +
@" ""ptr_opt"": ""test""," + "\n" +
@"" + "\n" +
@" ""txt_value"": ""test""," + "\n" +
@" " + "\n" +
@" ""old_type"": ""NS""," + "\n" +
@" ""old_host"": ""domain.com""," + "\n" +
@" ""old_value"": ""ns3.domain.com""" + "\n" +
@" }" + "\n" +
@" }" + "\n" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
{
"api": {
"process": "domain/dns/update",
"data": {
"domain_name": "domain.com",
"record_type": "A",
"ns_value": "ns3.domain.com",
"a_host": "test",
"a_value": "{{ip_address}}",
"cname_host": "test",
"cname_value": "test",
"mx_value": "test",
"mx_opt": "test",
"ptr_host": "test",
"ptr_value": "test",
"ptr_opt": "test",
"txt_value": "test",
"old_type": "NS",
"old_host": "domain.com",
"old_value": "ns3.domain.com"
}
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<api>
<process>domain/dns/update</process>
<data>
<domain_name>domain.com</domain_name>
<record_type>NS</record_type>
<a_host>new-test</a_host>
<a_value>222.222.222.222</a_value>
<old_type>A</old_type>
<old_host>test</old_host>
<old_value>test</old_value>
</data>
</api>
{
"result":{
"status":1,
"message":"Operation completed successful"
}
}