NAV
BRAINOZA OU
bash php python

Introduction

Our HTTP REST API allows you to manage vital details of your account and services in client portal. JSON is used for all API returns

Use left menu to browse trough available methods, use right menu to check required parameters, data to post and code samples in various languages.

Swagger Doc: You can download or display the JSON to generate documentation in Swagger.

Authentication

Basic Authentication

# pass the correct header with each request (-u option)
curl 'https://my.brainoza.com/api/details' \
    -u "username:password"
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);

$resp = $client->get('details');
# python requests module handles basic authentication if provided with auth parameter
payload = username
req = requests.get('https://my.brainoza.com/api/details', auth=('username', 'password'))
print(req.json())

Make sure to replace username and password with your client area details.

This authentication method requires that you send your client area username (email address) and password with each request.

API calls that require authentication expect a header in the form of Authorization: Basic <credentials>, where credentials is the Base64 encoding of username and password joined by a single colon :.

For example:
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

You can find more info on this authentication method here: Basic HTTP Authentication

Clientarea

Login

Generate new authorization token

POST_DATA="{
    \"username\": \"[email protected]\",
    \"password\": \"secret\"
}"

curl -X POST "https://my.brainoza.com/api/login" \
   -H "Content-Type: application/json" \
   -d "${POST_DATA}"
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
]);

$options = [
    'json' => [
        "username" => "[email protected]",
        "password" => "secret"
    ]
]
$resp = $client->post('login', $options);
echo $resp->getBody();
payload = {
    'username': "[email protected]",
    'password': "secret"
}


req = requests.post('https://my.brainoza.com/api/login', json=payload)
print(req.json())
Example Response:
{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRw(...)5lZ9T79ft9uwOkqRRmIBbtR51_w",
    "refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIzMD(...)ChwIAb3zvxBu6kvULa2AwAt9U-I"
}

HTTP Request

POST /login

Query Parameters

Parameter Type Description
username string

Your acount email address

password string

Account password

Logout

Invalidate authorization token


curl -X POST "https://my.brainoza.com/api/logout" \
   -u user:pass 
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);


$resp = $client->post('logout');
echo $resp->getBody();

auth=('username', 'password')

req = requests.post('https://my.brainoza.com/api/logout', auth=auth)
print(req.json())
Example Response:
{
    "status": true
}

HTTP Request

POST /logout

User Details

Return registration details for my account


curl -X GET "https://my.brainoza.com/api/details" \
   -u user:pass 
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);


$resp = $client->get('details');
echo $resp->getBody();

auth=('username', 'password')

req = requests.get('https://my.brainoza.com/api/details', auth=auth)
print(req.json())
Example Response:
{
    "client": {
        "id": "26",
        "email": "[email protected]",
        "lastlogin": "2016-12-30 12:24:28",
        "ip": "172.100.2.1",
        "host": "hostname",
        "firstname": "Joe",
        "lastname": "Doe",
        "companyname": "",
        "address1": "Pretty View Lane",
        "address2": "3294",
        "city": "Santa Rosa",
        "state": "California",
        "postcode": "95401",
        "country": "US",
        "phonenumber": "+1.24123123"
    }
}

HTTP Request

GET /details

Update User Details

Update registration details under my account

POST_DATA="{
    \"email\": \"emailValue\",
    \"firstname\": \"firstnameValue\",
    \"lastname\": \"lastnameValue\",
    \"companyname\": \"companynameValue\",
    \"address1\": \"address1Value\",
    \"address2\": \"address2Value\",
    \"city\": \"cityValue\",
    \"state\": \"stateValue\",
    \"postcode\": \"postcodeValue\",
    \"country\": \"countryValue\",
    \"phonenumber\": \"phonenumberValue\",
    \"type\": \"typeValue\"
}"

curl -X PUT "https://my.brainoza.com/api/details" \
   -u user:pass \
   -H "Content-Type: application/json" \
   -d "${POST_DATA}"
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);

$options = [
    'json' => [
        "email" => "emailValue",
        "firstname" => "firstnameValue",
        "lastname" => "lastnameValue",
        "companyname" => "companynameValue",
        "address1" => "address1Value",
        "address2" => "address2Value",
        "city" => "cityValue",
        "state" => "stateValue",
        "postcode" => "postcodeValue",
        "country" => "countryValue",
        "phonenumber" => "phonenumberValue",
        "type" => "typeValue"
    ]
]
$resp = $client->put('details', $options);
echo $resp->getBody();
payload = {
    'email': "emailValue",
    'firstname': "firstnameValue",
    'lastname': "lastnameValue",
    'companyname': "companynameValue",
    'address1': "address1Value",
    'address2': "address2Value",
    'city': "cityValue",
    'state': "stateValue",
    'postcode': "postcodeValue",
    'country': "countryValue",
    'phonenumber': "phonenumberValue",
    'type': "typeValue"
}

auth=('username', 'password')

req = requests.put('https://my.brainoza.com/api/details', json=payload, auth=auth)
print(req.json())
Example Response:
{
    "client": {
        "id": "26",
        "email": "[email protected]",
        "lastlogin": "2016-12-30 12:34:20",
        "ip": "172.100.2.1",
        "host": "hostname",
        "firstname": "Joe",
        "lastname": "Doe",
        "companyname": "",
        "address1": "Pretty View Lane",
        "address2": "3194",
        "city": "Santa Rosa",
        "state": "California",
        "postcode": "95401",
        "country": "US",
        "phonenumber": "+1.24123123"
    },
    "info": [
        "client_info_updated"
    ]
}

HTTP Request

PUT /details

Query Parameters

Parameter Type Description
email string

Email Address

firstname string

First Name

Value pattern: ^[A-Za-z]+$

lastname string

Last Name

Value pattern: ^[A-Za-z]+$

companyname string

Organization

address1 string

Address 1

address2 string

Address 2

city string

City

state string

State

postcode string

Post code

country string

Country

phonenumber string

Phone

type string

Account Type

Available values: Private, Company.

Billing

Account balance

Get current account balance(unpaid invoices total), account credit


curl -X GET "https://my.brainoza.com/api/balance" \
   -u user:pass 
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);


$resp = $client->get('balance');
echo $resp->getBody();

auth=('username', 'password')

req = requests.get('https://my.brainoza.com/api/balance', auth=auth)
print(req.json())
Example Response:
{
    {
        "success": true,
        "details": {
            "currency": "USD",
            "acc_balance": "123456.55",
            "acc_credit": "0.00"
        }
    }
}

HTTP Request

GET /balance

DNS

List DNS

Returns a list of all DNS


curl -X GET "https://my.brainoza.com/api/dns" \
   -u user:pass 
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);


$resp = $client->get('dns');
echo $resp->getBody();

auth=('username', 'password')

req = requests.get('https://my.brainoza.com/api/dns', auth=auth)
print(req.json())
Example Response:
{
    "service_ids": [
        "10",
        "20"
    ],
    "zones": [
        {
            "domain_id": "60",
            "name": "qwerty.com",
            "service_id": "10"
        },
        {
            "domain_id": "61",
            "name": "bgg12ooble.com",
            "service_id": "20"
        }
    ]
}

HTTP Request

GET /dns

Add DNS Zone

Creates a new DNS zone

POST_DATA="{
    \"service_id\": \"service_idValue\",
    \"name\": \"testzone.com\"
}"

curl -X POST "https://my.brainoza.com/api/service/@service_id/dns" \
   -u user:pass \
   -H "Content-Type: application/json" \
   -d "${POST_DATA}"
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);

$options = [
    'json' => [
        "service_id" => "service_idValue",
        "name" => "testzone.com"
    ]
]
$resp = $client->post('service/@service_id/dns', $options);
echo $resp->getBody();
payload = {
    'service_id': "service_idValue",
    'name': "testzone.com"
}

auth=('username', 'password')

req = requests.post('https://my.brainoza.com/api/service/@service_id/dns', json=payload, auth=auth)
print(req.json())
Example Response:
{
    "info": [
        "Domain zone testzone.com was created successfully."
    ]
}

HTTP Request

POST /service/@service_id/dns

Query Parameters

Parameter Type Description
service_id int

Service ID

name string

Zone name

List DNS for service

Returns a list of DNS zones under the service


curl -X GET "https://my.brainoza.com/api/service/@service_id/dns" \
   -u user:pass 
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);


$resp = $client->get('service/@service_id/dns');
echo $resp->getBody();

auth=('username', 'password')

req = requests.get('https://my.brainoza.com/api/service/@service_id/dns', auth=auth)
print(req.json())
Example Response:
{
    "error": [
        "invalid method"
    ]
}

HTTP Request

GET /service/@service_id/dns

Query Parameters

Parameter Type Description
service_id int

Service ID

Get DNS details

Returns details of the DNS zone


curl -X GET "https://my.brainoza.com/api/service/@service_id/dns/@zone_id" \
   -u user:pass 
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);


$resp = $client->get('service/@service_id/dns/@zone_id');
echo $resp->getBody();

auth=('username', 'password')

req = requests.get('https://my.brainoza.com/api/service/@service_id/dns/@zone_id', auth=auth)
print(req.json())
Example Response:
{
    "service_id": 10,
    "name": "qwerty.com",
    "records": [
      {
        "id":"10",
        "name":"qwerty",
        "ttl":1800,
        "priority":0,
        "content":"127.0.0.1",
        "type":"A"
      },
      {
        "id":"11",
        "name":"qwerty",
        "ttl":1800,
        "priority":0,
        "content":"ns1.qwerty.com",
        "type":"NS"
      }
    ]
}

HTTP Request

GET /service/@service_id/dns/@zone_id

Query Parameters

Parameter Type Description
service_id int

Service ID

zone_id int

Zone ID

Remove DNS zone

Deletes the selected DNS zone


curl -X DELETE "https://my.brainoza.com/api/service/@service_id/dns/@zone_id" \
   -u user:pass 
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);


$resp = $client->delete('service/@service_id/dns/@zone_id');
echo $resp->getBody();

auth=('username', 'password')

req = requests.delete('https://my.brainoza.com/api/service/@service_id/dns/@zone_id', auth=auth)
print(req.json())
Example Response:
{
   "info": [
     "Domain zone testzone.com was deleted successfully."
   ]
}

HTTP Request

DELETE /service/@service_id/dns/@zone_id

Query Parameters

Parameter Type Description
service_id int

Service ID

zone_id int

Zone ID

Add DNS Record

Creates a new record in the DNS zone

POST_DATA="{
    \"service_id\": \"service_idValue\",
    \"zone_id\": \"zone_idValue\",
    \"name\": \"example.com\",
    \"ttl\": 3600,
    \"priority\": 10,
    \"type\": \"A\",
    \"content\": \"192.168.1.2\"
}"

# OR ...

POST_DATA="{
    \"service_id\": \"service_idValue\",
    \"zone_id\": \"zone_idValue\",
    \"name\": \"_sip._tcp.example.com\",
    \"ttl\": 3600,
    \"priority\": 10,
    \"type\": \"SRV\",
    \"content\": [
        10,
        5060,
        \"vc01.example.com\"
    ]
}"

curl -X POST "https://my.brainoza.com/api/service/@service_id/dns/@zone_id/records" \
   -u user:pass \
   -H "Content-Type: application/json" \
   -d "${POST_DATA}"
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);

$options = [
    'json' => [
        "service_id" => "service_idValue",
        "zone_id" => "zone_idValue",
        "name" => "example.com",
        "ttl" => 3600,
        "priority" => 10,
        "type" => "A",
        "content" => "192.168.1.2"
    ]
]);

// OR ...

$options = [
    'json' => [
        "service_id" => "service_idValue",
        "zone_id" => "zone_idValue",
        "name" => "_sip._tcp.example.com",
        "ttl" => 3600,
        "priority" => 10,
        "type" => "SRV",
        "content" => [
            10,
            5060,
            "vc01.example.com"
        ]
    ]
]);

$resp = $client->post('service/@service_id/dns/@zone_id/records', $options);
echo $resp->getBody();
payload = {
    'service_id': "service_idValue",
    'zone_id': "zone_idValue",
    'name': "example.com",
    'ttl': 3600,
    'priority': 10,
    'type': "A",
    'content': "192.168.1.2"
}

# OR ...

payload = {
    'service_id': "service_idValue",
    'zone_id': "zone_idValue",
    'name': "_sip._tcp.example.com",
    'ttl': 3600,
    'priority': 10,
    'type': "SRV",
    'content': [
        10,
        5060,
        "vc01.example.com"
    ]
}

auth=('username', 'password')

req = requests.post('https://my.brainoza.com/api/service/@service_id/dns/@zone_id/records', json=payload, auth=auth)
print(req.json())
Example Response:
{
    "record": {
      "name": "_sip._tcp.example.com",
      "type": "SRV",
      "ttl": "3600",
      "priority": "10",
      "content": [
        10,
        5060,
        "vc01.example.com"
      ]
    },
    "info": [
        "dnsnewrecordadded",
        "SRV"
    ]
}

HTTP Request

POST /service/@service_id/dns/@zone_id/records

Query Parameters

Parameter Type Description
service_id int

Service ID

zone_id int

Zone ID

name string

Record name

ttl int

Record ttl

priority int

Priority of the record

type string

Record type

content string

Contents of the record

Edit DNS Record

Edits the selected DNS zone record

POST_DATA="{
    \"service_id\": \"service_idValue\",
    \"zone_id\": \"zone_idValue\",
    \"record_id\": \"record_idValue\",
    \"name\": \"example.com\",
    \"ttl\": 3600,
    \"priority\": 10,
    \"type\": \"A\",
    \"content\": \"192.168.1.2\"
}"

curl -X PUT "https://my.brainoza.com/api/service/@service_id/dns/@zone_id/records/@record_id" \
   -u user:pass \
   -H "Content-Type: application/json" \
   -d "${POST_DATA}"
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);

$options = [
    'json' => [
        "service_id" => "service_idValue",
        "zone_id" => "zone_idValue",
        "record_id" => "record_idValue",
        "name" => "example.com",
        "ttl" => 3600,
        "priority" => 10,
        "type" => "A",
        "content" => "192.168.1.2"
    ]
]
$resp = $client->put('service/@service_id/dns/@zone_id/records/@record_id', $options);
echo $resp->getBody();
payload = {
    'service_id': "service_idValue",
    'zone_id': "zone_idValue",
    'record_id': "record_idValue",
    'name': "example.com",
    'ttl': 3600,
    'priority': 10,
    'type': "A",
    'content': "192.168.1.2"
}

auth=('username', 'password')

req = requests.put('https://my.brainoza.com/api/service/@service_id/dns/@zone_id/records/@record_id', json=payload, auth=auth)
print(req.json())
Example Response:
{
    "record": {
        "id": "55",
        "type": "A",
        "ttl": "3600",
        "name": "test",
        "priority": 0,
        "content": "192.168.1.2"
    },
    "info": [
        "The record was updated successfully."
    ]
}

HTTP Request

PUT /service/@service_id/dns/@zone_id/records/@record_id

Query Parameters

Parameter Type Description
service_id int

Service ID

zone_id int

Zone ID

record_id int

Record ID

name string

Record name

ttl int

Record ttl

priority int

Priority of the record

type string

Record type

content string

Contents of the record

Remove DNS Record

Removes the selected DNS zone record


curl -X DELETE "https://my.brainoza.com/api/service/@service_id/dns/@zone_id/records/@record_id" \
   -u user:pass 
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://my.brainoza.com/api/',
    'auth' => ['username', 'password']
]);


$resp = $client->delete('service/@service_id/dns/@zone_id/records/@record_id');
echo $resp->getBody();

auth=('username', 'password')

req = requests.delete('https://my.brainoza.com/api/service/@service_id/dns/@zone_id/records/@record_id', auth=auth)
print(req.json())

HTTP Request

DELETE /service/@service_id/dns/@zone_id/records/@record_id

Query Parameters

Parameter Type Description
service_id int

Service ID

zone_id int

Zone ID

record_id int

Record ID