Loyalty Points System API
This API allows customers create accounts, login, earn points for purchases, and redeem those points for rewards.
Membership Service ¶
Loyalty Program Membership Service endpoints
Create Account ¶
Create User account and send activation email
Account creationPOST/api/auth/register
Example URI
with Body
Headers
Content-Type: application/json
Body
{
"username": "YourUsername23",
"firstname": "your",
"lastname": "your",
"gender": "your",
"email": "user@example.com",
"password": "your",
"city": "your",
"phone_number": "your"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"username": {
"type": "string"
},
"firstname": {
"type": "string",
"description": "firstname (required)"
},
"lastname": {
"type": "string",
"description": "lastname (required)"
},
"gender": {
"type": "string",
"description": "gender (required)"
},
"email": {
"type": "string"
},
"password": {
"type": "string",
"description": "password (required)"
},
"city": {
"type": "string",
"description": "city (required)"
},
"phone_number": {
"type": "string",
"description": "phone-number (required)"
}
},
"required": [
"username",
"email"
]
}
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "\"We sent an email with a verification code to user@example.com\""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
]
}
400
Body
{
"status": "fail",
"message": "error"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
409
Body
{
"status": "fail",
"message": "\"User with that credential already exists\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "\"Things have gone really bad!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
502
Body
{
"status": "error",
"message": "\"Error!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
VerifyEmail ¶
Verify email of correspondent account and grant login access
User email verificationGET/api/auth/verify-email/:{secret_code}
Example URI
- secret_code
string
(required) Example: 26dlFidiTVJHFH7Y
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "\"Email verified successfully\""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
]
}
400
Body
{
"status": "fail",
"message": "\"Invalid verification code or user doesn't exist\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
409
Body
{
"status": "fail",
"message": "\"User already verified\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "\"Things have gone really bad!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Signin ¶
Validate logging in of user
User loginPOST/api/auth/login
Example URI
with Body
Headers
Content-Type: application/json
Body
{
"email": "user@example.com",
"password": "your_password"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
},
"required": [
"email",
"password"
]
}
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"token": "dfghjkloiuytredfghjiuytredfcvbjkiouytr"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"token": {
"type": "string"
}
},
"required": [
"status",
"token"
]
}
400
Body
{
"status": "fail",
"message": "\"Invalid email or Password\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
403
Body
{
"status": "fail",
"message": "\"Please verify your email\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "\"Things have gone really bad!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Logout ¶
Send an expired cookie to the user’s browser or client. Sending the expired cookie will invalidate the user’s ‘session’.
User logoutGET/api/auth/logout
Example URI
200
Body
{
"status": "success",
"message": "\"You have been logged out!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Get User Data ¶
Retrieve the currently logged-in user’s information.
Get user dataGET/api/users/me
Example URI
Headers
Cookie: token=<token_value>
200
Body
{
"status": "success",
"data": {
"user": {
"username": "YourUsername23",
"firstname": "yourFirstname",
"lastname": "yourLastname",
"email": "user@example.com",
"phone_number": "+25412345789",
"redeemable_points": 250,
"city": "Nairobi",
"card_number": "0123456789012"
}
}
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "The user's username"
},
"firstname": {
"type": "string",
"description": "The user's first name"
},
"lastname": {
"type": "string",
"description": "The user's last name"
},
"email": {
"type": "string",
"description": "The user's email"
},
"phone_number": {
"type": "string",
"description": "The user's phone number"
},
"redeemable_points": {
"type": "number",
"description": "The user's total points"
},
"city": {
"type": "string",
"description": "The user's city"
},
"card_number": {
"type": "string",
"description": "The user's virtual card number"
}
},
"required": [
"username",
"firstname",
"lastname",
"email",
"phone_number",
"redeemable_points",
"city",
"card_number"
],
"description": "The user data"
}
},
"required": [
"user"
]
}
},
"required": [
"status",
"data"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
401
Body
{
"status": "fail",
"message": "\"You are not logged in\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Change User Product ¶
Change PasswordPATCH/api/users/me/change-password
Update the logged in user’s password
Example URI
Headers
Content-Type: application/json
Cookie: token=<token-value>
Authorization: Bearer <jwt>
Body
{
"new_password": "yournewpassword",
"confirm_password": "yournewpassword"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"new_password": {
"type": "string"
},
"confirm_password": {
"type": "string"
}
},
"required": [
"new_password",
"confirm_password"
]
}
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "Password change successful"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
]
}
400
Body
{
"status": "error",
"message": "Passwords do not match"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
401
Body
{
"status": "fail",
"message": "You are not logged in"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "Failed to udpate password"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Products ¶
Get All Available Products ¶
Get All ProductsGET/api/users/products
Retrieves a list of all available products.
Example URI
Headers
Cookie: token=<token_value>
Authorization: Bearer <jwt>
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "Products Retrieval successful!",
"data": {
"products": [
{
"product_name": "Airtime 10 KES",
"product_description": "By Lexcom",
"product_price": 250
}
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"products": {
"type": "array",
"description": "The list of all available products"
}
},
"required": [
"products"
]
}
},
"required": [
"status",
"message",
"data"
]
}
401
Body
{
"status": "fail",
"message": "You are not logged in"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
404
Body
{
"status": "fail",
"message": "Products not found"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "Failed to retrieve products"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Points ¶
Loyalty Program Members Redeem Points endpoint
Redeem Points ¶
Redeem Points earned for a product/service
Points RedemptionPOST/api/users/me/redeem
Example URI
with Body
Headers
Content-Type: application/json
Body
{
"product_name": "Airtime 20 KES",
"product_quantity": 1
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"product_name": {
"type": "string"
},
"product_quantity": {
"type": "number"
}
},
"required": [
"product_name",
"product_quantity"
]
}
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "\"Redemption successful\"",
"redeemed_product": "\"Airtime 20 KES\"",
"redeemed_points": 500,
"balance": {
"redeemable_points": 0
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"redeemed_product": {
"type": "string"
},
"redeemed_points": {
"type": "number"
},
"balance": {
"type": "object",
"properties": {
"redeemable_points": {
"type": "number",
"description": "The user's balance of redeemable points"
}
},
"required": [
"redeemable_points"
]
}
},
"required": [
"status",
"message",
"redeemed_product",
"redeemed_points",
"balance"
]
}
401
Body
{
"status": "fail",
"message": "\"You are not logged in\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
404
Body
{
"status": "fail",
"message": "\"Product not found\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "\"Things have gone really bad!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Transaction History ¶
Loyalty Program Members View Transaction Data Endpoint
View Transaction History ¶
Get a list of a logged in user’s transaction data
List all TransactionsGET/api/users/me/transaction-history
Example URI
Headers
Cookie: token=<token_value>
Authorization: Bearer <jwt>
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "\"Transaction History Retrieval successful!\"",
"data": {
"transactions": [
{
"points": 150,
"state": "EARN",
"description": "COMPLETE INFO SITE BONUS",
"date": "June 3, 2023",
"time": "20:39:58"
}
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"transactions": {
"type": "array",
"description": "The user's list of transactions"
}
},
"required": [
"transactions"
]
}
},
"required": [
"status",
"message",
"data"
]
}
401
Body
{
"status": "fail",
"message": "\"You are not logged in\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
404
Body
{
"status": "fail",
"message": "\"Transactions not found\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "\"Failed to retrieve transactions\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Reset Password ¶
Endpoints to reset a user’s forgotten password
Forgot Password ¶
Send password reset email to the requesting user email
Forgot passwordPOST/api/auth/forgot-password
Example URI
with Body
Headers
Content-Type: application/json
Body
{
"email": "user@example.com"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string"
}
},
"required": [
"email"
]
}
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "We sent an email with a reset password code to user"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string",
"description": "email@example.com (required)"
}
},
"required": [
"status"
]
}
400
Body
{
"status": "error",
"message": "error"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string",
"description": "msg"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
404
Body
{
"status": "fail",
"message": "User not found"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "fail",
"message": "Failed to retrieve user"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Reset Password ¶
Reset user’s password
Reset passwordPATCH/api/auth/reset-password/{resetToken}
Example URI
- resetToken
string
(required)user’s password reset token
with Body
Headers
Content-Type: application/json
Body
{
"new_password": "yournewpassword",
"confirm_password": "yournewpassword"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"new_password": {
"type": "string"
},
"confirm_password": {
"type": "string"
}
},
"required": [
"new_password",
"confirm_password"
]
}
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "Password reset successful"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
]
}
400
Body
{
"status": "fail",
"message": "error"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string",
"description": "msg (required)"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Admins ¶
Admin endpoints of loyalty-program api
Login ¶
Authenticates an admin user and returns an access token.
Admin loginPOST/api/auth/admin/login
Example URI
with Body
Headers
Content-Type: application/json
Body
{
"username": "YourUsername23",
"password": "your"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string",
"description": "password (required)"
}
},
"required": [
"username"
]
}
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"token": "dfghjkloiuytredfghjiuytredfcvbjkiouytr"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"token": {
"type": "string"
}
},
"required": [
"status",
"token"
]
}
400
Body
{
"status": "fail",
"message": "\"Invalid Password\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "\"Things have gone really bad!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Logout ¶
Send an expired cookie to the browser or client. Sending the expired cookie will invalidate the admin’s ‘session’.
Admin logoutGET/api/admin/logout
Example URI
200
Body
{
"status": "success",
"message": "\"You have been logged out!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Add New Product ¶
Create ProductPOST/api/admin/product
Creates a new product.
Example URI
with Body
Headers
Content-Type: application/json
Body
{
"product_name": "AIRTIME 10 KES",
"product_description": "By Lexcom",
"product_price": 250,
"quantity": 10
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"product_name": {
"type": "string"
},
"product_description": {
"type": "string",
"description": "Hellopay (required)"
},
"product_price": {
"type": "number"
},
"quantity": {
"type": "number"
}
},
"required": [
"product_name",
"product_price",
"quantity"
]
}
201
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "\"Product added successfully\""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
]
}
401
Body
{
"status": "fail",
"message": "\"You are not logged in\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "\"Things have gone really bad!\""
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Update a Product ¶
Update ProductPUT/api/admin/product/{id}
Updates a product by its id
Example URI
- id
number
(required)id of the product to be update
with Body
Headers
Content-Type: application/json
Body
{
"product_name": "AIRTIME 10 KES",
"product_description": "By Lexcom",
"product_price": 250,
"quantity": 10
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"product_name": {
"type": "string"
},
"product_description": {
"type": "string",
"description": "Hellopay (required)"
},
"product_price": {
"type": "number"
},
"quantity": {
"type": "number"
}
},
"required": [
"product_name",
"product_price",
"quantity"
]
}
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "Product updated successfully"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
]
}
400
Body
{
"status": "fail",
"message": "Failed to retrieve product"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
401
Body
{
"status": "fail",
"message": "You are not logged in"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
404
Body
{
"status": "fail",
"message": "Product not found"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "Failed to udpate product"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Delete a Product ¶
Delete ProductDELETE/api/admin/product/{id}
Deletes a product by its id
Example URI
- id
number
(required)id of the product to be delete
204
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "Product deleted successfully"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status",
"message"
]
}
400
Body
{
"status": "fail",
"message": "Failed to retrieve product"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
401
Body
{
"status": "fail",
"message": "You are not logged in"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
404
Body
{
"status": "fail",
"message": "Product not found"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "Failed to delete product"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
Get All Products ¶
Get ProductsGET/api/admin/product
Retrieves a list of all products.
Example URI
Headers
Cookie: token=<token_value>
Authorization: Bearer <jwt>
200
Headers
Content-Type: application/json
Body
{
"status": "success",
"message": "Products Retrieval successful!",
"data": {
"products": [
{
"ID": 1,
"CreatedAt": "2023",
"UpdatedAt": "2023",
"DeletedAt": "2023",
"product_name": "Airtime 10 KES",
"product_description": "By Lexcom",
"product_price": 250,
"quantity": 7
}
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"products": {
"type": "array",
"description": "The list of all available products"
}
},
"required": [
"products"
]
}
},
"required": [
"status",
"message",
"data"
]
}
401
Body
{
"status": "fail",
"message": "You are not logged in"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
404
Body
{
"status": "fail",
"message": "Products not found"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
500
Body
{
"status": "error",
"message": "Failed to retrieve products"
}
Schema
{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"status"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}