FlowMart API is a RESTful API designed to help SMEs manage their stock efficiently. It allows users to create accounts, manage product categories, and add and view products by category. The API is built using the Laravel framework and is secured with session-based API keys.
- Create an Account: Allows users to register new accounts.
- Login to Account: Provides user authentication and generates an API key for authenticated sessions.
- Create a Product Category: Allows users to create product categories for better stock organization.
- Create Products for a Category: Lets users add products under specific categories.
- Display Products by Category: Retrieves and displays all products in a specific category.
- Fetch All Categories: Retrieves and displays all product categories.
- Fetch All Products: Retrieves and displays all products across all categories.
- PHP >= 8.2
- Composer
- Laravel 11.x
- MySQL or other supported database
- Postman or cURL for API testing
-
Clone the repository:
git clone https://github.com/angatiabenson/flow-mart-api.git
-
Navigate to the project directory:
cd flow-mart-api
-
Install dependencies:
composer install
-
Copy
.env.example
to.env
and configure your environment settings:cp .env.example .env
Update the following parameters in your
.env
file:DB_DATABASE
: The name of your MySQL database.DB_USERNAME
: Your database username.DB_PASSWORD
: Your database password.
-
Generate an application key:
php artisan key:generate
-
Run database migrations:
php artisan migrate
-
Start the Laravel development server:
php artisan serve
The API will be available at
http://localhost:8000
.
Authentication is done via API key, which is generated upon user login. The API key must be passed in the Authorization
header for all requests that require authentication.
Authorization: Bearer {API_KEY}
To help you get started and effectively integrate with our platform, comprehensive API documentation is available. This documentation provides detailed information about all available endpoints, request and response structures, authentication methods, and example usage scenarios.
You can explore the interactive API documentation through Swagger UI by visiting the following link:
FlowMart API is an open API, and developers can access it using the following base URL:
https://flowmart.banit.co.ke/
All API endpoints described above can be accessed by appending the relevant paths to this base URL. For example, to fetch all product categories, you would use:
GET https://flowmart.banit.co.ke/categories
Ensure to include any necessary authentication tokens, where required, as per the endpoint descriptions.
This project is licensed under the MIT License. See the LICENSE file for details.