API : Service

Service Management API


Get Status wise service count

POST /api/service/status_count

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
location_code N Location Code
sub_location_code N Sub Location Code

Typical API Call

curl -X POST $BASE_URL/api/service/status_count -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4"

{
    "result": {
        "Active": 90,
        "Suspend": 125,
        "NP": 0,
        "NPD": 26,
        "Online": 13,
        "Total": 241
    },
    "error": null
}

Note: Online service count means that the total count of successfully authenticated services, which includes Active, Suspend, NP and NPD status services.


Get Service list

POST /api/service/list

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
ispid N ISP ID
resellerid N Reseller ID
serviceid N Service ID
customerid N Customer ID
username N Username
planid N Plan ID
subplanid N Sub Plan ID
mac N MAC Address
bw_level N Bandwidth Level. Allowed values: 1, 2, 3
billed N Is Billed? Allowed values: Y, N
prepaid_postpaid N Allowed values: Prepaid, Postpaid
location_code N Location Code
sub_location_code N Sub Location Code
status N Status. Allowed values: Active, NP, NPD, Suspend, NewRequest
protocol N Protocol. Allowed values: PPPoE, IPoE
connectivity N Connectivity. Allowed values: Fiber, Wireless, Hotspot
ippool N IP Pool Name
ip_assignment N IP Assignment By. Allowed values: NAS, IPpool, StaticIP, Subnet
staticip N Static IP
tax_id N Tax ID. VAT/GST/Tax Number
discount_percent N Discount %. Accepted Comparison Operators, like: <50, ≤10, ≥80, =100, etc.
discount_amt N Discount Amt. Accepted Comparison Operators, like: <50, ≤10, ≥80, =100, etc.
deposit N Deposit. Accepted Comparison Operators, like: <50, ≤10, ≥80, =100, etc.
credit_limit N Credit Limit. Accepted Comparison Operators, like: <50, ≤10, ≥80, =100, etc.
used_gb N Used GB. Accepted Comparison Operators, like: <50, ≤10, ≥80, =100, etc.
os_amt N Outstanding Amt. Accepted Comparison Operators, like: <50, ≤10, ≥80, =100, etc.
service_created_from N Created from date in yyyy-mm-dd format
service_created_upto N Created upto date in yyyy-mm-dd format
valid_from N Validity from date in yyyy-mm-dd format
valid_upto N Validity upto date in yyyy-mm-dd format
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
sort_field N Sorts the result. Sort field should be any one of: id, username, customerid, planid, subplanid, protocol, connectivity, prepaid_postpaid, status, used_gb, os_amt, location_code, sub_location_code, valid_from, valid_upto, deposit, staticip. Default: id
sort_order N Sort order. Allowed values are: asc, desc. Default: asc
show_count N Shows Records Count only, instead of detailed results. This will ignore rows_limit, rows_offset. Allowed values are: 0, 1. Default: 0

Typical API Call

curl -X POST $BASE_URL/api/service/list -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d resellerid=1 -d os_amt=">=1000"


Create Service

POST /api/service/create

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
customerid Y Customer ID
planid Y Plan ID
subplanid Y Sub Plan ID
username Y Username
password Y Password
bill_from N Billing start date in yyyy-mm-dd format. Default: Today's Date
billing_start_day N Billing start day of the month. Applicable only to Monthly Plans. Allowed values: 0 to 30 format. Default: Today's Date. Default: 0, 0 means day number of the renewal date.
discount_percent N Discount Percentage. Allowed values: 0 to 100. Default: 0
discount_amt N Discount Amt. Default: 0
tax_id N Customer's Tax ID. VAT/GST/Tax Number
location_code Y Location Code
sub_location_code Y Sub Location Code
protocol Y Protocol. Allowed values: PPPoE, IPoE
connectivity Y Connectivity. Allowed values: Wireless, Fibre, Hotspot
prepaid_postpaid Y Allowed values: Prepaid, Postpaid
ip_assignment N IP Assignment. Allowed values: NAS, IPpool, StaticIP. Default: NAS
ippool N IP Pool Name
staticip N Static IP. To set staticip, ippool is required.
mac N MAC Address
mac_bind N MAC Bind option. Allowed values: Auto, Manual, No. Default: Auto. To set Manual MAC bind, need to specify mac field
deposit N Deposit Amt. Default: 0
installation_amt N Installation charges. Default: 0
credit_limit N Credit Limit. Default: null
latitude N Lattitude
longitude N Longitude
installation_address Y Installation address. Allowed values: new, same. Default: same. same means, same as Customer's Address.
ia_zipcode N Installation Addr Zipcode. Required if installation_address set to new
ia_state N Installation Addr State. Required if installation_address set to new
ia_city N Installation Addr City. Required if installation_address set to new
ia_street N Installation Addr Street. Required if installation_address set to new
billing_address Y Billing address. Allowed values: new, same, ia. Default: same. ia means Installation Addr
ba_zipcode N Billing Addr Zipcode. Required if billing_address set to new
ba_state N Billing Addr State. Required if billing_address set to new
ba_city N Billing Addr City. Required if billing_address set to new
ba_street N Billing Addr Street. Required if billing_address set to new

Typical API Call

curl -X POST $BASE_URL/api/service/create -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d customerid=1450 -d planid=69 -d subplanid=157 -d username="user1234" -d password="password" -d protocol="PPPoE" -d connectivity="Fibre" -d prepaid_postpaid="Postpaid" -d location_code="LOC1" -d sub_location_code="SLC1" -d installation_address="same" -d billing_address="same"

The expected API Response will be

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

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


Update Service

POST /api/service/update

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
serviceid Y Service ID of the Service Record to update
password N Set new Password to PPPoE/Hotspot
billing_start_day N Billing start day of the month. Applicable only to Monthly Plans. Allowed values: 0 to 30 format. Default: Today's Date. Default: 0, 0 means day number of the renewal date.
discount_percent N Discount Percentage. Allowed values: 0 to 100. Default: 0
discount_amt N Discount Amt. Default: 0
tax_id N Customer's Tax ID. VAT/GST/Tax Number
location_code N Location Code
sub_location_code N Sub Location Code
connectivity N Connectivity. Allowed values: Wireless, Fibre
prepaid_postpaid N Allowed values: Prepaid, Postpaid
ip_assignment N IP Assignment. Allowed values: NAS, IPpool, StaticIP. Default: NAS
ippool N IP Pool Name of Radius/CRM.
To set ippool, the field ip_assignment="IPpool"
To unset ippool, set ip_assignment to NAS
staticip N Static IP.
To set staticip, the fields ip_assignment="StaticIP" and ippool is required.
To unset staticip, set ip_assignment to NAS or IPpool
mac N MAC Address
mac_bind N MAC Bind option. Allowed values: Auto, Manual, No. Default: Auto. To set Manual MAC bind, need to specify mac field
latitude N Lattitude
longitude N Longitude
installation_address N Installation address. Allowed values: new, same. Default: same. same means, same as Customer's Address.
ia_zipcode N Installation Addr Zipcode. Required if installation_address set to new
ia_state N Installation Addr State. Required if installation_address set to new
ia_city N Installation Addr City. Required if installation_address set to new
ia_street N Installation Addr Street. Required if installation_address set to new
billing_address N Billing address. Allowed values: new, same, ia. Default: same. ia means Installation Addr
ba_zipcode N Billing Addr Zipcode. Required if billing_address set to new
ba_state N Billing Addr State. Required if billing_address set to new
ba_city N Billing Addr City. Required if billing_address set to new
ba_street N Billing Addr Street. Required if billing_address set to new

Typical API Call

curl -X POST $BASE_URL/api/service/update -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d serviceid=1559 -d mac_bind="Manual" -d mac="65:ec:ac:76:60:0e"

The expected API Response will be

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

Delete Service

POST /api/service/delete

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
serviceid Y Service ID to delete

Typical API Call

curl -X POST $BASE_URL/api/service/delete -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d serviceid=1559

The expected API Response will be

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

MAC Unbind

POST /api/service/mac_unbind

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
serviceid Y Service ID to Unbind MAC

Typical API Call

curl -X POST $BASE_URL/api/service/mac_unbind -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d serviceid=1551

The expected API Response will be

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

Plan Change

POST /api/service/planchange

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
serviceid Y Service ID to change plan
planid Y New Plan ID
subplanid Y New Sub Plan ID
schedule N This is Billing schedule for new plan price. This won't affect plan change schedule. Irrespective of this parameter, plan will be changed immediately.
Allowed values: immediate, next_bill. Default: next_bill

Typical API Call

curl -X POST $BASE_URL/api/service/planchange -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d serviceid=1551 -d planid=25 -d subplanid=117 -d schedule="next_bill"

The expected API Response will be

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

Topup

POST /api/service/topup

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
serviceid Y Service ID to Topup
topup_planid N Topup Plan ID. If topup_planid is specified, below gb, amt, type can be ignored
gb N Volume of data (in GB) to Topup. Required if topup_planid is not specified
amt N Price for the above GB. Required if topup_planid is not specified
type N Topup Type. Allowed values: Expiring, NonExpiring. Required if topup_planid is not specified. NonExpiring means the unused data balance (in GB) will be carried over to next validity renewal

Typical API Call

curl -X POST $BASE_URL/api/service/topup -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d serviceid=1551 -d gb=10 -d amt=500 -d type="Expiring"

The expected API Response will be

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

Other actions

POST /api/service/action

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
serviceid Y Service ID to perform action
action N Action to be Executed. Allowed values: update_usage, renew, invoice, bill, suspend, np, npd, restore, reconnect, block, unblock

Typical API Call

curl -X POST $BASE_URL/api/service/action -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d serviceid=1551 -d action="suspend"

The expected API Response will be

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

Usage Report

POST /api/service/usage_report

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value
api_key Y api_key for the above Userid
serviceid Y Service ID to get Usage Report
report_format Y Report format. Allowed values: detailed, day_wise_summary, month_wise_summary, year_wise_summary
source Y Data Source. Allowed values: recent, archive
date_from Y Report from date in yyyy-mm-dd
date_upto Y Report upto date in yyyy-mm-dd
nas N NAS IP address. Used only if report_format=detailed
mac N Client MAC address. Used only if report_format=detailed
ip N Client IP address. Used only if report_format=detailed

* Date range can be max 100 days for report_format=detailed & source=recent. And max date range can be 1100 days for other reports.

Typical API Call

curl $BASE_URL/api/service/usage_report -d userid=10 -d api_key="2107b12bfabd8af926da0e048d0e74e742a6c49dd94ff5ff2c" -d serviceid=1019 -d date_from="2020-10-01" -d date_upto="2020-10-02" -d source="archive" -d report_format="detailed"

The expected API Response will be

{
    "result": [
        {
            "ispid":"1", "resellerid":"1", "radacctid":"216806", "acctsessionid":"81801228", 
            "acctuniqueid":"40d327e999ac01f7ae0e43eba758c4d7", "username":"lena999",
            "realm":"", "nasipaddress":"172.20.20.1", "nasportid":"ether3",
            "nasporttype":"Ethernet", "acctstarttime":"2020-10-01 00:20:14", 
            "acctupdatetime":"2020-10-01 09:40:14", "acctstoptime":"2020-10-01 09:46:41",
            "acctinterval":"599", "acctsessiontime":"33986", "acctauthentic":"RADIUS",
            "connectinfo_start":"", "connectinfo_stop":"", "acctinputoctets":"36421923",
            "acctoutputoctets":"951885494", "calledstationid":"pppoe3",
            "callingstationid":"F4:6E:93:4C:6E:FD", "acctterminatecause":"User-Request",
            "servicetype":"Framed-User", "framedprotocol":"PPP", "framedipaddress":"10.1.1.251"
        },
        ....
    ],
    "error": null
}

another example

curl $BASE_URL/api/service/usage_report -d userid=10 -d api_key="2107b12bfabd8af926da0e048d0e74e742a6c49dd94ff5ff2c" -d serviceid=1019 -d date_from="2020-10-01" -d date_upto="2020-10-31" -d source="archive" -d report_format="day_wise_summary"

The expected API Response will be

{
    "result": [
        {
            "report_period":"2020-10-01", 
            "onlinetime":33986,
            "ul":36421923,
            "dl":951885494
        },
        {
            "report_period":"2020-10-02",
            "onlinetime":120574,
            "ul":1070843782,
            "dl":6020084273
        },
        {
            "report_period":"2020-10-03",
            "onlinetime":86000,
            "ul":501631126,
            "dl":6336925425
        },
        ....
    ],
    "error": null
}