API : Radius

Radius API


Get Online users list

POST /api/radius/user/online

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
nasip N NAS IP
session_starttime N Session Start time in yyyy-mm-dd HH:MM:SS format.
Optionally you can prefix comparison oprators: >=, <=, >, < and =.
Example value is: >= 2022-05-19 10:02:30
session_endtime N Session End time in yyyy-mm-dd HH:MM:SS format.
Optionally you can prefix comparison oprators: >=, <=, >, < and =.
Example value is: >= 2022-05-19 10:02:30
session_updatetime N Session Update time in yyyy-mm-dd HH:MM:SS format.
Optionally you can prefix comparison oprators: >=, <=, >, < and =.
Example value is: >= 2022-05-19 10:02:30
session_duration N Session Duration in seconds.
Optionally you can prefix comparison oprators: >=, <=, >, < and =.
Example value is: <= 3600
stale_duration N Stale Session Duration in minutes. Filter online sessions since the time elapsed from last interim update.
rows_limit N Limit the number of records in result set. Default: 10. Max value: 100
rows_offset N Fetch records from this offset position. Default: 0
show_count N Shows Records Count only, instead of detailed results. Allowed values are: 0, 1. Default: 0

Typical API Call

curl -X POST $BASE_URL/api/radius/user/online -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d resellerid=1

The sample response will have Session ID and Username as below:

{
    "result": {
        "454513":"e2_stk_jerin",
        "454670":"e2_stk_mano",
        "454696":"e2_stk_vish"
    },
    "error":null
}

Online Status of a User

POST /api/radius/user/status

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
username Y Username

Typical API Call

curl -X POST $BASE_URL/api/radius/user/status -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d username="demo"

The Typical API Response will be

{
    "result": {
        "sessionid":"12345",
        "ip":"10.1.1.198",
        "mac":"E6:82:63:BE:0C:13",
        "nas":"172.20.20.1",
        "nasport":"ether3",
        "nasporttype":"Ethernet",
        "session_start":"2020-07-10 18:29:01",
        "session_stop":null,
        "session_duration":"55200",
        "last_update":"2020-07-11 09:49:01",
        "ul_mb": "245.9185",
        "dl_mb": "1362.7231",
    },
    "error": null
}

Last online info of a User

POST /api/radius/user/last_online

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
username Y Username

Typical API Call

curl -X POST $BASE_URL/api/radius/user/last_online -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d username="demo"

The Typical API Response will be

{
    "result": {
        "sessionid":"12345",
        "ip":"10.1.1.198",
        "mac":"E6:82:63:BE:0C:13",
        "nas":"172.20.20.1",
        "nasport":"ether3",
        "nasporttype":"Ethernet",
        "session_start":"2020-07-10 18:29:01",
        "session_stop":2020-07-11 09:49:01,
        "session_duration":"55200",
        "last_update":"2020-07-11 09:49:01",
        "ul_mb": "245.9185",
        "dl_mb": "1362.7231",
    },
    "error": null
}

Disconnect a Online user

POST /api/radius/user/disconnect

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
username N Username. Either Username or NAS IP is Required
nasip N NAS IP. All online session of this NAS will be terminated. It is takes longer time to complete, if online user count is higher. Either Username or NAS IP is Required
force N Forced to send disconnect request to NAS, even the user is offline. Allowed values are : Y or N. Default: N. Thid field is considered only for single username input.

Typical API Call

curl -X POST $BASE_URL/api/radius/user/disconnect -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d username="e2_demo4"

The successful response will be

{
    "result": "done",
    "error": null
}

Incase of any error, the error field contains error description


Authentication Log of a User

This API returns the recent 10 records of Authentication log of a user

POST /api/radius/user/auth_log

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
username N Username
ispid N ISP ID
resellerid N Reseller ID
nasip N NAS IP
response N Allowed values are: Access-Accept or Access-Reject
date_from N From date in yyyy-mm-dd or yyyy-mm-dd HH:MM:SS format.
date_to N To date in yyyy-mm-dd or yyyy-mm-dd HH:MM:SS format.
rows_limit N Limit the number of records in result set. Default: 10. Max value: 100

Typical API Call

curl -X POST $BASE_URL/api/radius/user/auth_log -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d username="demouser3"



User's session history

POST /api/radius/user/sessoin_log

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
nasip N NAS IP
userip N User IP
usermac N User MAC
nasip N NAS IP
session_starttime N Session Start time in yyyy-mm-dd HH:MM:SS format.
Optionally you can prefix comparison oprators: >=, <=, >, < and =.
Example value is: >= 2022-05-19 10:02:30.
If comparison operator is ingnoed, the default value asumed as : =
session_endtime N Session End time in yyyy-mm-dd HH:MM:SS format.
Optionally you can prefix comparison oprators: >=, <=, >, < and =.
Example value is: >= 2022-05-19 10:02:30.
If comparison operator is ingnoed, the default value asumed as : =
session_updatetime N Session Update time in yyyy-mm-dd HH:MM:SS format.
Optionally you can prefix comparison oprators: >=, <=, >, < and =.
Example value is: >= 2022-05-19 10:02:30.
If comparison operator is ingnoed, the default value asumed as : =
session_duration N Session Duration in seconds.
Optionally you can prefix comparison oprators: >=, <=, >, < and =.
Example value is: <= 3600.
If comparison operator is ingnoed, the default value asumed as : =
stale_duration N Stale Session Duration in minutes. Filter online sessions since the time elapsed from last interim update.
rows_limit N Limit the number of records in result set. Default: 10. Max value: 100
rows_offset N Fetch records from this offset position. Default: 0
show_count N Shows Records Count only, instead of detailed results. Allowed values are: 0, 1. Default: 0

Typical API Call

curl -X POST $BASE_URL/api/radius/user/session_log -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d session_endtime="NULL"

The sample response will have Session ID and Username as below:

{
    "result": [
        {
            "sessionid": "454513",
            "username": "e218jerin",
            "nasip": "10.1.4.1",
            "starttime": "2022-02-14 17:25:00",
            "endtime": null,
            "updatetime": "2022-02-15 06:05:00",
            "duration": "45601",
            "ul_mb": "245.9185",
            "dl_mb": "1362.7231",
            "usermac": "12:34:56:78:2A:CD",
            "userip": "10.0.0.214"
        },
        { ... },
        { ... },
    ],

    "error":null
}



Radius IP Pool → List

IP Pools are created and used in Radius and NAS independently. There is no relationship between Radius IP Pool and NAS IP pool. Each serves different purposes. Radius IP Pools can be manged through CRM only. And NAS IP pool can be managed only from NAS.

Purpose

  • Radius IP Pools are used to assign static IP to users and Radius managed DHCP for users.
  • NAS IP pools are used to mange user's bandwidth in NAS with help of single Queue creation on NAS. In nomal cases, NAS (Mikrotik) creates seperate queue for each PPPoE users. This is much CPU overhead in NAS while number of PPPoE connection increases. To make it as CPU friendly you can create a single queue for a each NAS IP Pool. Similarly on plan creation, you may change the BW Management to NAS IP Pool. And set NAS IP Pool Name value is same as the IP Pool name added in NAS. During PPPoE authentication, Radius will instruct the NAS, use the IP Pool name which was configured in plan. So NAS will allocate a free IP from its own IP pool and then Bandwidth will be managed with queue you created in NAS for that IP pool. Please note that, in this case Bandwidth will be never managed by CRM.

POST /api/radius/ippool/list

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
ip3 N First 3 octects of IPv4 address to search. Example: 192.168.30
pool_name N Radius IP Pool name. You can use % in search query.
vendor N NAS Vendor/Brand.
rows_limit N Limit the number of records in result set. Default: 10. Max value: 100
rows_offset N Fetch records from this offset position. Default: 0
show_count N Shows Records Count only, instead of detailed results. Allowed values are: 0, 1. Default: 0

Typical API Call

curl -X POST $BASE_URL/api/radius/ippool/list -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4"


The typical response will be as below:

{
    "result": [
        {
            "pool_name": "100Mbps-DL",
            "range_from": "10.2.1.2",
            "range_upto": "10.2.1.254",
            "count": "253",
            "staticip_count": 13,
            "free": 240
        },
        { ... },
        { ... },
    ],

    "error":null
}

Radius IP Pool → IP List

This API lists the list of IPs in given IP Pool


POST /api/radius/ippool/iplist

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
pool_name N Radius IP Pool name
type N IP type. Allowed values are: staticip, inuse, free, all. Default: all
username N PPPoE Username
ip N IPv4 address
rows_limit N Limit the number of records in result set. Default: 10. Max value: 100
rows_offset N Fetch records from this offset position. Default: 0
show_count N Shows Records Count only, instead of detailed results. Allowed values are: 0, 1. Default: 0

Typical API Call

curl -X POST $BASE_URL/api/radius/ippool/iplist -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4"


Typical API response will be as below:

{
    "result": [
        {
            "ispid": "9",
            "resellerid": "4",
            "username": "",
            "pool_name": "test",
            "ip": "10.2.1.3"
        },
        { ... },
        { ... },
    ],

    "error":null
}

Radius IP Pool → Create

POST /api/radius/ippool/create

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
pool_name Y Radius IP Pool name
range_from Y IPv4 address starts from. Example: 192.168.30.2
range_upto Y IPv4 address ending range. Example: 192.168.30.254

Typical API Call

curl -X POST $BASE_URL/api/radius/ippool/create -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d resellerid=7 -d name="100Mbps-DL" -d range_from="192.168.30.2" -d range_upto="192.168.30.254"

The expected API Response will be

{
    "result": 253,
    "error": null
}

Returns number of IPs added, upon success. Upon failure result contains null value, and error contains error description.


Radius IP Pool → Update

POST /api/radius/ippool/update

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
pool_name Y Radius IP Pool name
new_pool_name N New IP Pool name. Use this field only if you want to change the above IP Pool name
range_from N IPv4 address starts from. Example: 192.168.30.2. Please note that, the existing IP address ranges are either extended or shrinked based on new input values.
range_upto N IPv4 address ending range. Example: 192.168.30.20

Typical API Call

curl -X POST $BASE_URL/api/radius/ippool/update -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d resellerid=7 -d name="100Mbps-DL" -d range_from="192.168.30.2" -d range_upto="192.168.30.20"

The expected API Response will be

{
    "result": 232,
    "error": null
}

Returns number of IPs inserted or updated, upon success. Upon failure result contains null value, and error contains error description.


Radius IP Pool → Delete

POST /api/radius/ippool/delete

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
pool_name N Radius IP Pool name. By providing pool_name only, the entire IP address list in this pool and the pool_name will be deleted
range_from N IPv4 address starts from. Example: 192.168.30.2. Please note that, the existing IP address ranges are shrinked or removed based on new input values.
range_upto N IPv4 address ending range. Example: 192.168.30.20

Typical API Call

curl -X POST $BASE_URL/api/radius/ippool/delete -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d resellerid=7 -d name="100Mbps-DL"

The expected API Response will be

{
    "result": done,
    "error": null
}



NAS List

POST /api/radius/nas/list

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
id N NAS ID
ip N NAS IP
name N NAS Name. Wildcard search is available. You can use % in search query.
vendor N NAS Vendor/Brand.
rows_limit N Limit the number of records in result set. Default: 10. Max value: 100
rows_offset N Fetch records from this offset position. Default: 0
show_count N Shows Records Count only, instead of detailed results. Allowed values are: 0, 1. Default: 0

Typical API Call

curl -X POST $BASE_URL/api/radius/nas/list -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4"


Create NAS

POST /api/radius/nas/create

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID. Optional, If above Login userid belongs to an ISP, otherwise Required.
resellerid N Reseller ID. Optional, If above Login userid belongs to a Reseller, otherwise Required. Set this value to 0, if you want to create NAS for ISP and you can share this NAS with Resellers
resellers N Comma seperated list of Reseller IDs. Example: resellers="2,3,5". This filed is only required if above resellerid=0. This field takes list of Reseller IDs to share the ISP's NAS. By setting resellers="*" will apply this NAS can be shared by all Resellers. If no input is passed (or) leaving this field empty, will be assumed as, NAS has to be shared among all Resellers.
name Y NAS Name
secret Y NAS Secret
ip Y NAS IP
vendor N NAS Vendor. Optional. Default: Mikrotik. Allowed values are: Mikrotik, Cisco, ZTE
coa_port N CoA Port. Optional. Default: 3799
snmp_graph N Enable SNMP Graph. Default: off, Allowed values are: on, off
http_port N NAS http port for downloading above SNMP graph. As of now works only with Mikrotik. Allowed values: 1 - 65536. Mandatory if snmp_graph=on
api_enable N Enable NAS API. Default: off, Allowed values are: on, off
api_username N API Username. Mandatory if api_enable=on
api_password N API Password. Mandatory if api_enable=on
api_port N API Port. Mandatory if api_enable=on
description N Description

Typical API Call

curl -X POST $BASE_URL/api/radius/nas/create -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d resellerid=7 -d name="Main office" -d secret="Sec$#2t" -d ip="172.4.0.1"

The expected API Response will be

{
    "result": 16,
    "error": null
}

Returns newly created NAS id value, upon success. Upon failure result contains null value, and error contains error description.


Update NAS

POST /api/radius/nas/update

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
id Y NAS ID.
resellers N Comma seperated list of Reseller IDs. Example: resellers="2,3,5". This filed is to set share the ISP owned NAS among Resellers. Set resellers="*" to share this NAS with all Resellers
name N NAS Name
secret N NAS Secret
ip N NAS IP
vendor N NAS Vendor. Allowed values are: Mikrotik, Cisco, ZTE
coa_port N CoA Port
snmp_graph N Enable SNMP Graph. Allowed values are: on, off
http_port N NAS http port for downloading above SNMP graph. Allowed values: 1 - 65536.
api_enable N Enable NAS API. Allowed values are: on, off
api_username N API Username
api_password N API Password
api_port N API Port
description N Description

Typical API Call

curl -X POST $BASE_URL/api/radius/nas/update -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d id=7 -d name="Main office" -d secret="Sec$#2t" -d ip="172.4.0.1"

The expected API Response will be

{
    "result": "done",
    "error": null
}

Delete NAS

POST /api/radius/nas/delete

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
id Y NAS ID

Typical API Call

curl -X POST $BASE_URL/api/radius/nas/delete -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4"

The expected API Response will be

{
    "result": "done",
    "error": null
}



NAS IP Pool List

POST /api/radius/nas/ippool_list

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
id N IP Pool ID
name N IP Pool Name. Wildcard search is available. You can use % in search query.
rows_limit N Limit the number of records in result set. Default: 10. Max value: 100
rows_offset N Fetch records from this offset position. Default: 0
show_count N Shows Records Count only, instead of detailed results. Allowed values are: 0, 1. Default: 0

Typical API Call

curl -X POST $BASE_URL/api/radius/nas/ippool_list -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4"



NAS IP Pool :: Create

POST /api/radius/nas/ippool_create

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
name Y IP Pool Name
notes N Notes

Typical API Call

curl -X POST $BASE_URL/api/radius/nas/ippool_create -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d resellerid=4 -d "10 Mbps Pool" -d notes="For home users"

The expected API Response will be

{
    "result": 21,
    "error": null
}

Returns newly created IP Pool id value, upon success. Upon failure result contains null value, and error contains error description.



NAS IP Pool :: Update

POST /api/radius/nas/ippool_update

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
id Y NAS IP Pool ID
name N IP Pool Name
notes N Notes

Typical API Call

curl -X POST $BASE_URL/api/radius/nas/ippool_update -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d id=21 -d "15 Mbps Pool"

The expected API Response will be

{
    "result": "done",
    "error": null
}


NAS IP Pool :: Delete

POST /api/radius/nas/ippool_delete

Input Parameters Required? Description
userid Y CRM Login User's numerical ID
api_key Y api_key for the above Userid
id Y NAS IP Pool ID to be deleted

Typical API Call

curl -X POST $BASE_URL/api/radius/nas/ippool_delete -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d id=21

The expected API Response will be

{
    "result": "done",
    "error": null
}