Admin
Info about admin(s)
STAGING_URL: https://switchapi3.azurewebsites.net
LIVE_URL: https://switchapi.azurewebsites.netGet admin info
GET https://switchapi3.azurewebsites.net/admin
This endpoint retrieves the details of the admin currently logged in.
Headers
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
id
integer
admin id
Headers
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
}
}{
"message": "Admin with id - 100 -, does not exist"
}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
SWI-CS
string
Payload checksum
SWI-CID
string
Client ID
Authorization
string
Format for the Authorization is Bearer token_string
Request Body
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
}
}{
"message": "Error occurred creating admin",
"errors": {
"email": [
"has already been taken"
],
"role": [
"can't be blank"
]
}
}Get admin list
GET https://switchapi3.azurewebsites.net/admin/list
This endpoint retrieves the list of admins.
Query Parameters
search_query
string
Query used to search admin's emails
page
string
Defaults to 1
per_page
string
Defaults to 20
Headers
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
}
}{
"message": "Only a superadmin can list admins"
}Disable admin
POST https://switchapi3.azurewebsites.net/admin/disable/:id
This endpoint allows super-admins to disable admins.
Path Parameters
id
string
id of the admin
Headers
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
}
}{
"message": "Admin is already disabled"
}{
"message": "Cannot disable self"
}{
"message": "Admin with id - 3 -, does not exist"
}Enable a disabled admin
POST https://switchapi3.azurewebsites.net/admin/enable/:id
This endpoint allows superadmins to enable disabled admins.
Path Parameters
id
string
id of the admin
Headers
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
}
}{
"message": "Admin is not disabled"
}{
"message": "Admin with id - 2 -, does not exist"
}Change Password
POST https://switchapi3.azurewebsites.net/admin/update_password
Change admin password.
Headers
SWI-CS
string
Payload checksum
SWI-CID
string
Client ID
Authorization
string
Format for Authorization is Bearer token_string
Request Body
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
}
}{
"message": "Error occurred changing password",
"errors": {
"password": [
"has been used previously. Please try a new password"
]
}
}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
id
string
The id of the admin whose password is to be reset
Headers
SWI-CID
string
Client ID
Authorization
string
Format for Authorization is Bearer token_string
{
"message": "password reset successfully"
}{
"message": "Only an admin with a role of super_admin can perform this action"
}{
"message": "admin with id -1100- does not exist"
}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
id
string
The id of the admin to be unlocked.
Headers
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"
}{
"message": "Only an admin with a role of super_admin can perform this action"
}{
"message": "admin with id -1100- does not exist"
}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
id
string
The id of the admin
Headers
SWI-CS
string
Payload checksum
SWI-CID
string
Client ID
Authorization
string
Format for Authorization is Bearer token.
Request Body
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
}
}{
"message": "Admin role is already admin"
}Last updated
Was this helpful?