๐ Authentication
This API uses Bearer token authentication. First, login to get your access token.
POST
/api/login
- Get authentication token
Request Body:
{
"username": "admin",
"password": "password123"
}
Test this endpoint:
๐ก API Endpoints
๐ Categories
GET
/api/categories
- List all categories
Returns all categories with contact counts.
POST
/api/categories
- Create new category
Request Body:
{
"name": "New Category Name"
}
GET
/api/categories/{id}
- Get specific category
Returns a specific category by ID.
PUT
/api/categories/{id}
- Update category
Request Body:
{
"name": "Updated Category Name"
}
DELETE
/api/categories/{id}
- Delete category
Deletes a category by ID. Note: Categories with existing contacts cannot be deleted.
๐ฅ Contacts
GET
/api/contacts
- List all contacts
Returns all contacts with category information. Supports search and filtering.
POST
/api/contacts
- Create new contact
Request Body:
{
"name": "John Doe",
"company_name": "Example Corp",
"designation": "Manager",
"category_id": 1,
"mobile_number": "+1234567890",
"landline_number": "+1234567891",
"email_address": "john@example.com",
"notes": "Sample contact"
}
GET
/api/contacts/{id}
- Get specific contact
Returns a specific contact by ID with category information.
PUT
/api/contacts/{id}
- Update contact
Request Body:
{
"name": "Updated Name",
"company_name": "Updated Company",
"designation": "Updated Title",
"category_id": 1,
"mobile_number": "+1234567890",
"email_address": "updated@example.com"
}
DELETE
/api/contacts/{id}
- Delete contact
Deletes a contact by ID. This will also remove any associated business card photos.
GET
/api/contacts/export
- Export contacts to CSV
Exports all contacts to CSV format with category information.
๐ค User Management
GET
/api/user
- Get current user info
Returns information about the authenticated user.
POST
/api/logout
- Logout user
Invalidates the current access token.
๐งช Testing Instructions
- Login First: Use the login endpoint to get your access token
- Copy Token: Copy the token from the login response
- Test Endpoints: Use the test buttons above to test different API endpoints
- Check Responses: View the response data in the gray boxes below each test
- Logout: Use the logout endpoint to invalidate your token when done
๐ก Pro Tips:
- All protected endpoints require the Authorization header:
Authorization: Bearer YOUR_TOKEN - Use tools like Postman or curl for more advanced testing
- Check the browser console for any JavaScript errors
- Token expires when you logout or after a certain time period
- Test all CRUD operations: Create, Read, Update, Delete
- Try different data combinations to test validation