FlexiREST - User Documentation

Table of Contents

  1. Installation
  2. Configuration
  3. JWT Authentication
  4. IP Filtering
  5. API Usage Examples

Installation

To install FlexiREST, follow these steps:

  1. Download the ZIP file from the project repository.
  2. Extract the contents of the ZIP file to your chosen location.
  3. Navigate to the extracted directory.
  4. Copy the config/database_example.php file to config/database.php and configure your database settings.
  5. Copy the config/auth_example.php file to config/auth.php and set the JWT secret key.
  6. Update the allowed tables and IP filtering settings in the config/api.php file.

Configuration

FlexiREST requires the configuration of several files to function correctly:

JWT Authentication

To use the API with JWT authentication, include the JWT token in the Authorization header of your requests.

curl -X GET http://localhost/api/users -H "Authorization: Bearer your_jwt_token_here"

IP Filtering

FlexiREST allows filtering access to the API based on IP addresses. You can configure allowed and blocked IP addresses in the config/api.php file. IP filtering can be enabled or disabled globally using the enabled option in the configuration. You can also set specific IP access limits by adding IP addresses to the allowed and blocked arrays in the ip_filters section.

API Usage Examples

Basic CRUD Operations

Filtering by Column

FlexiREST allows filtering results based on column values. Use the endpoint GET /api/{table}/{column}/{value} to filter results.

curl -X GET "http://localhost/api/users/email/john.doe@example.com"

FlexiREST supports pagination to help manage large datasets. Use the page and itemsPerPage query parameters to control pagination.

curl -X GET "http://localhost/api/users?page=2&itemsPerPage=5"

JWT Authentication

To use the API with JWT authentication, include the JWT token in the Authorization header of your requests.

curl -X GET http://localhost/api/users -H "Authorization: Bearer your_jwt_token_here"

API Documentation

You can access the full API documentation using Swagger UI at:

http://localhost/api/docs.html

This interactive documentation provides detailed information about all available endpoints, request parameters, and response formats.