API : Auth

API for Authentication module

This API collections are providing endpoints for managing CRM Login users creation, updation and getting user details.


Get CRM login users list

POST /api/auth/user/list

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value, for API authentication.
api_key Y api_key for the above Userid, for API authentication
id N User ID
username N Username
ispid N ISP ID
resellerid N Reseller ID
groupname N Filter the users by gropname. Allowed values are: ISP, Reseller, Employee
status N User status. Allowed values are: Active, Suspend
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. Allowed values are: id, username, groupname, ispid, resellerid. 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. Allowed values are: 0, 1. Default: 0

Typical API Call

curl -X POST $BASE_URL/api/auth/user/list -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d id=14

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

{
    "result": {
        [
            "id": "14",
            "username": "user_2_5",
            "ispid": "2",
            "resellerid": "5",
            "groupname": "Reseller",
            "lc": "",
            "slc": "",
            "cash_balance": "0.00",
            "cash_limit": "0.00",
            "status": "Active",
            "created_at": "2022-08-07 13:11:00",
            "updated_at": "2022-08-07 13:11:00",
            "created_by": "isp2",
            "updated_by": "isp2"
        },
        { ... }
    ],
    "error":null
}

Create User

POST /api/auth/user/create

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value. Not username
api_key Y api_key for the above Userid
username Y Username
password Y Password
groupname Y Groupname. Allowed values are: ISP, Reseller, Employee
roles Y Roles. Multiple roles can be given as comma seperated values
ispid Y New user's ISP ID
resellerid Y New user's Reseller ID. This field not applicable, if groupname=ISP
lc N New user's Location code. This field not applicable, if groupname=ISP,Reseller
slc N New user's Sub Location code. This field not applicable, if groupname=ISP,Reseller
cash_limit Y User's cash collection limit

Typical API Call

curl -X POST $BASE_URL/api/auth/user/create -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d username="reseller9" -d password="12345" -d ispid=2 -d resellerid=4 -d groupname="Reseller" -d roles="Reseller"

The Typical API Response will be

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

Returns newly User's id value, upon success. Upon failure result contains null value, and error contains error description.


Update User

POST /api/auth/user/update

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value. Not username
api_key Y api_key for the above Userid
id Y User id
username N New Username
password N New Password
groupname N New Groupname. Allowed values are: ISP, Reseller, Employee
roles N New Roles. Multiple roles can be given as comma seperated values
ispid N For changing user's ISP ID
resellerid N For changing user's Reseller ID
lc N Location code
slc N Sub Location code
cash_limit N Set User's cash collection limit
status N Change user status. Allowed values are: Active, Suspend

Typical API Call

curl -X POST $BASE_URL/api/auth/user/update -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d id=16 -d roles="Franchisee"

The Typical API Response will be

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

Delete user

POST /api/auth/user/delete

Input Parameters Required ? Description
userid Y CRM Login User's numerical ID value. Not username
api_key Y api_key for the above Userid
id Y User ID to delete.

Typical API Call

curl -X POST $BASE_URL/api/auth/user/delete -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d id=16

The successful response will be

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

Incase of any error, the error field contains error description


Get User's assigned Roles

This API returns the roles assigned to the given user

POST /api/auth/user/roles

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

Typical API Call

curl -X POST $BASE_URL/api/auth/user/roles -d userid=5 -d api_key="0f9895fb407c83e5ea128082098b47681aa75d6944576423c4" -d id=24

The Typical API Response will be

{
    "result": [
        "Reseller"
    ],
    "error": null
}