Skip to content

API Core

Julien Brochet edited this page Mar 10, 2020 · 8 revisions

List of endpoints available in the API Core.


list_ddns_extip

Get the external IPv4 and IPv6 addresses.

result = client.core.list_ddns_extip()
{
    'ip': '92.10.197.59',
    'ipv6': '0:0:0:0:0:0:0:0',
    'type': 'WAN'
}

list_ddns_record

Get the DDNS record.

result = client.core.list_ddns_record()
{
    'next_update_time': '2019-02-16 08:52',
    'records': [
        {
            'enable': True,
            'heartbeat': True,
            'hostname': 'foobar.synology.me',
            'id': 'Synology',
            'ip': '92.10.197.59',
            'ipv6': '0:0:0:0:0:0:0:0',
            'lastupdated': '2019-02-15 08:52',
            'net': 'DEFAULT',
            'provider': 'Synology',
            'status': 'service_ddns_normal',
            'username': '[email protected]'
        }
    ]
}

get_system_utilization

Get system utilization (cpu, memory, ...).

result = client.core.get_system_utilization()
{
    "cpu": {
        "15min_load": 8,
        "1min_load": 19,
        "5min_load": 9,
        "device": "System",
        "other_load": 1,
        "system_load": 6,
        "user_load": 1
    },
    "disk": {
        "disk": [],
        "total": {
            "device": "total",
            "read_access": 0,
            "read_byte": 0,
            "utilization": 0,
            "write_access": 0,
            "write_byte": 0
        }
    },
    "memory": {
        "avail_real": 109484,
        "avail_swap": 260332,
        "buffer": 67712,
        "cached": 122960,
        "device": "Memory",
        "memory_size": 524288,
        "real_usage": 36,
        "si_disk": 0,
        "so_disk": 0,
        "swap_usage": 0,
        "total_real": 471324,
        "total_swap": 262140
    },
    "network": [
        {
            "device": "total",
            "rx": 41741,
            "tx": 42506
        },
        {
            "device": "bwlan0",
            "rx": 0,
            "tx": 0
        },
        {
            "device": "bwlan1",
            "rx": 0,
            "tx": 0
        },
        {
            "device": "eth0",
            "rx": 37766,
            "tx": 4359
        },
        {
            "device": "lbr0",
            "rx": 3975,
            "tx": 38147
        }
    ],
    "space": {
        "lun": [],
        "total": {
            "device": "total",
            "read_access": 0,
            "read_byte": 0,
            "utilization": 0,
            "write_access": 0,
            "write_byte": 1265
        },
        "volume": [
            {
                "device": "mmcblk0p6",
                "display_name": "volume1",
                "read_access": 0,
                "read_byte": 0,
                "utilization": 0,
                "write_access": 0,
                "write_byte": 1265
            }
        ]
    },
    "time": 1548882854
}

get_network_nsm_device

Get the list of all devices connected to the network.

# Get all devices
result = client.core.get_network_nsm_device()
# Get only connected devices
result = client.core.get_network_nsm_device({'is_online': True})
# Get only non-connected devices
result = client.core.get_network_nsm_device({'is_online': False})
# Get only Wi-Fi connected devices
result = client.core.get_network_nsm_device({
    'is_online': True,
    'connection': 'wifi',
})
[
    {
        'band': '5G',
        'connection': 'wifi',
        'current_rate': 144,
        'dev_type': 'others',
        'hostname': 'TV',
        'ip6_addr': '',
        'ip_addr': '10.10.10.244',
        'is_baned': True,
        'is_beamforming_on': False,
        'is_guest': False,
        'is_high_qos': False,
        'is_low_qos': False,
        'is_manual_dev_type': False,
        'is_manual_hostname': True,
        'is_online': True,
        'is_parental_controled': False,
        'is_qos': False,
        'is_wireless': True,
        'mac': '7c:92:e5:1f:b7:0a',
        'max_rate': 300,
        'rate_quality': 'middle',
        'signalstrength': 86,
        'transferRXRate': 142,
        'transferTXRate': 299
    },
    [...]
]

get_ngfw_traffic

Gets network traffic statistics for the specified interval.

# Get live traffic
result = client.core.get_ngfw_traffic('live')
# Get traffic for the previous 24 hours
result = client.core.get_ngfw_traffic('day')
[
    {
        'deviceID': '64:0d:50:d6:0b:c7',
        'download': 110,
        'download_packets': 0,
        'recs': [
            {
                'download': 110,
                'download_packets': 0,
                'protocollist': [
                    {
                        'download': 51,
                        'download_packets': 0,
                        'protocol': 120,
                        'upload': 39,
                        'upload_packets': 0
                    },
                    {
                        'download': 59,
                        'download_packets': 0,
                        'protocol': 220,
                        'upload': 39,
                        'upload_packets': 0
                    }
                ],
                'time': 1582464854,
                'upload': 78,
                'upload_packets': 0
            }
        ],
        'upload': 78,
        'upload_packets': 0
    },
    [...]
]

list_certificate

List all TLS certificates setup in the router.

result = client.core.list_certificate()
[
    {
        'issuer': {
            'city': 'Taipei',
            'common_name': 'Synology Inc. CA',
            'country': 'TW',
            'department': 'Certificate Authority',
            'email': '[email protected]',
            'organization': 'Synology Inc.',
            'state': 'Taiwan'
        },
        'signature_algorithm': 'sha256WithRSAEncryption',
        'subject': {
            'city': 'Taipei',
            'common_name': 'Synology Inc. CA',
            'country': 'TW',
            'department': 'Certificate Authority',
            'email': '[email protected]',
            'organization': 'Synology Inc.',
            'state': 'Taiwan'
        },
        'type': 'root_cert'
    },
    [...]
]

export_certificate

Download all TLS certificates in a ZIP file.

client.core.export_certificate(path='/var/backup/certificate.zip')
N/A