Admin

Info about admin(s)

STAGING_URL: https://switchapi3.azurewebsites.net
LIVE_URL: https://switchapi.azurewebsites.net

Get admin info

GET https://switchapi3.azurewebsites.net/admin

This endpoint retrieves the details of the admin currently logged in.

Headers

Name
Type
Description

SWI-CID

string

Client ID

Authorization

string

Format for Authorization is Bearer token_string

{
    "message": "Admin retrieved successfully",
    "data": {
        "id": 11,
        "email": "cs@switch.ng",
        "role": "customer_success",
        "disabled": false,
        "locked": false,
        "has_changed_password": true,
        "password_expired": false
    }
}

Get admin by id

GET https://switchapi3.azurewebsites.net/admin/:id

This endpoint retrieves the admin by searching with the id

Path Parameters

Name
Type
Description

id

integer

admin id

Headers

Name
Type
Description

SWI-CID

string

Client ID

Authorization

string

Format for the Authorization is Bearer token_string

{
    "message": "Admin retrieved successfully",
    "data": {
        "id": 26,
        "email": "admin7@gmail.com",
        "role": "admin",
        "disabled": false
    }
}

Create admin

POST https://switchapi3.azurewebsites.net/admin/new

This endpoint creates a new admin and sends a randomly generated password to the admin's email if creation is successful.

Headers

Name
Type
Description

SWI-CS

string

Payload checksum

SWI-CID

string

Client ID

Authorization

string

Format for the Authorization is Bearer token_string

Request Body

Name
Type
Description

email

string

admin email

role

string

Could be customer_success, banking_operations, admin or super_admin

{
    "message": "Admin created successfully",
    "data": {
        "id": 11,
        "email": "admin6@gmail.com",
        "role": "admin",
        "disabled": false
    }
}

Get admin list

GET https://switchapi3.azurewebsites.net/admin/list

This endpoint retrieves the list of admins.

Query Parameters

Name
Type
Description

search_query

string

Query used to search admin's emails

page

string

Defaults to 1

per_page

string

Defaults to 20

Headers

Name
Type
Description

SWI-CID

string

Client ID

Authorization

string

Format for the Authorization is Bearer token_string

{
    "message": "Admins retrieved successfully",
    "data": [
        {
            "id": 26,
            "email": "admin7@gmail.com",
            "role": "admin",
            "disabled": false
        },
        {
            "id": 12,
            "email": "ollaollu@gmail.com",
            "role": "super_admin",
            "disabled": false
        },
        {
            "id": 11,
            "email": "admin6@gmail.com",
            "role": "admin",
            "disabled": false
        },
        {
            "id": 8,
            "email": "admin5@gmail.com",
            "role": "admin",
            "disabled": false
        },
        {
            "id": 7,
            "email": "admin4@gmail.com",
            "role": "admin",
            "disabled": false
        },
        {
            "id": 6,
            "email": "admin3@gmail.com",
            "role": "admin",
            "disabled": false
        },
        {
            "id": 5,
            "email": "admin2@gmail.com",
            "role": "admin",
            "disabled": false
        },
        {
            "id": 4,
            "email": "admin1@gmail.com",
            "role": "admin",
            "disabled": false
        }
    ],
    "meta": {
        "total": 8,
        "per_page": 20,
        "page": 1,
        "page_count": 1
    }
}

Disable admin

POST https://switchapi3.azurewebsites.net/admin/disable/:id

This endpoint allows super-admins to disable admins.

Path Parameters

Name
Type
Description

id

string

id of the admin

Headers

Name
Type
Description

SWI-CID

string

Client ID

Authorization

string

Format for Authorization is Bearer token_string

{
    "message": "Admin disabled successfully",
    "data": {
        "id": 5,
        "email": "admin2@gmail.com",
        "role": "admin",
        "disabled": true
    }
}

Enable a disabled admin

POST https://switchapi3.azurewebsites.net/admin/enable/:id

This endpoint allows superadmins to enable disabled admins.

Path Parameters

Name
Type
Description

id

string

id of the admin

Headers

Name
Type
Description

SWI-CID

string

Client ID

Authorization

string

Format for Authorization is Bearer token_string

{
    "message": "Admin enabled successfully",
    "data": {
        "id": 5,
        "email": "admin2@gmail.com",
        "role": "customer_success",
        "disabled": false
    }
}

Change Password

POST https://switchapi3.azurewebsites.net/admin/update_password

Change admin password.

Headers

Name
Type
Description

SWI-CS

string

Payload checksum

SWI-CID

string

Client ID

Authorization

string

Format for Authorization is Bearer token_string

Request Body

Name
Type
Description

current_password

string

The admin's current password

password

string

The new password

password_confirmation

string

password confirmation

{
    "message": "Admin password changed successfully",
    "data": {
        "id": 4,
        "email": "admin1@gmail.com",
        "role": "super_admin",
        "disabled": false
    }
}

Reset Admin Password

POST https://switchapi3.azurewebsites.net/admin/reset_password/:id

This endpoint allows a super admin to reset an admin's password. The new password (which is randomly generated) is then sent to the admin's email.

Path Parameters

Name
Type
Description

id

string

The id of the admin whose password is to be reset

Headers

Name
Type
Description

SWI-CID

string

Client ID

Authorization

string

Format for Authorization is Bearer token_string

{
    "message": "password reset successfully"
}

Unlock Account

POST https://switchapi3.azurewebsites.net/admin/unlock/:id

This endpoint allows a super admin to send an unlock email to the locked admin's email address.

Path Parameters

Name
Type
Description

id

string

The id of the admin to be unlocked.

Headers

Name
Type
Description

SWI-CID

string

Client ID

Authorization

string

Format for Authorization is Bearer token_string

{
    "message": "unlock email has been sent to this admin's mail"
}

Update Role

POST https://switchapi3.azurewebsites.net/admin/role/:id

This endpoint allows a super admin to update the role of another admin.

Path Parameters

Name
Type
Description

id

string

The id of the admin

Headers

Name
Type
Description

SWI-CS

string

Payload checksum

SWI-CID

string

Client ID

Authorization

string

Format for Authorization is Bearer token.

Request Body

Name
Type
Description

role

string

Any of customer_success, banking_operations, admin or super_admin

{
    "message": "Admin role updated successfully",
    "data": {
        "id": "19",
        "email": "someone@gmail.com",
        "disabled": false,
        "role": "admin",
        "has_changed_password": false,
        "locked": false
    }
}

Last updated

Was this helpful?