API Integration Guide
Simple guide to connect your app with your website's API. No technical expertise required!
What is API Integration?
Think of API as a bridge between your mobile app and your website. When someone logs in on the app, it talks to your website to check if the login is correct.
🔧 Quick Setup
Step 1: Set Your Website URL
- Open the
.env
file in your app folder - Change this line to your website address:
API_BASE_URL=https://your-website.com
Example:
API_BASE_URL=https://mystore.com
Step 2: Test the Connection
- Run your app
- Try to login
- If it works, you're connected! 🎉
If it doesn't work:
- Make sure your website URL is correct
- Check if your website is online
- Contact your website developer
📱 What Your App Can Do
Your app connects to your website to:
👤 User Features
- Login/Register: Users can create accounts and sign in
- Social Login: Login with Google, Facebook, Apple
- Profile: Users can update their information
- Addresses: Save shipping addresses
🛍️ Shopping Features
- Browse Products: See all your products
- Search: Find specific products
- Categories: Browse by product categories
- Shopping Cart: Add/remove items
- Wishlist: Save favorite products
- Compare: Compare different products
📦 Order Features
- Place Orders: Complete purchases
- Order History: See past orders
- Track Orders: Check delivery status
- Reviews: Rate and review products
🔍 How to Check if Everything Works
Test User Login
- Open your app
- Try to register a new account
- Try to login with the account
- ✅ Success: You see the home screen
- ❌ Problem: You see an error message
Test Product Loading
- Go to the products page
- ✅ Success: You see your products from the website
- ❌ Problem: No products show or error message
Test Shopping Cart
- Add a product to cart
- Go to cart page
- ✅ Success: Product appears in cart
- ❌ Problem: Cart is empty or error
🚨 Common Problems & Solutions
Problem: "Connection Failed" or "Network Error"
Possible Causes:
- Wrong website URL in
.env
file - Website is down
- Internet connection issues
Solutions:
- Check your website URL is correct
- Test your website in a browser
- Check your internet connection
- Contact your website developer
Problem: "Login Failed"
Possible Causes:
- API not configured on website
- Wrong login credentials
- Account doesn't exist
Solutions:
- Make sure you can login on your website
- Check if API is enabled on your website
- Try creating a new account first
Problem: "No Products Showing"
Possible Causes:
- No products in your website database
- API not returning product data
- Category/filter issues
Solutions:
- Check if products exist on your website
- Try refreshing the app
- Check if categories are set up correctly
Problem: "Cart Not Working"
Possible Causes:
- User not logged in
- API session expired
- Cart API not configured
Solutions:
- Make sure user is logged in
- Try logging out and back in
- Contact your developer to check cart API
🔧 For Developers: Quick API Setup
If you're a developer helping with the setup:
Required API Endpoints
Your website needs these API endpoints working:
Authentication:
POST /api/auth/login
- User loginPOST /api/auth/register
- User registrationPOST /api/auth/social/google
- Google loginPOST /api/auth/social/facebook
- Facebook login
Products:
GET /api/products
- Get product listGET /api/products/{id}
- Get product detailsGET /api/categories
- Get categories
Shopping:
GET /api/cart
- Get user's cartPOST /api/cart/add
- Add to cartPOST /api/orders
- Create order
Quick Test
Test if APIs work by visiting:
https://your-website.com/api/products
You should see product data in JSON format.
💡 Tips for Success
Before You Start
- Make sure your website works - Test login, products, and orders on your website first
- Have your website URL ready - You'll need the exact address
- Contact your developer - If you're not technical, ask for help
During Setup
- Test one thing at a time - Don't change multiple settings at once
- Keep backups - Save your original files before making changes
- Document changes - Write down what you changed
After Setup
- Test everything - Try all features in the app
- Test on different devices - Android and iPhone if possible
- Ask users to test - Get feedback from real users
📞 Getting Help
When to Contact Support
- App won't connect to your website
- Login doesn't work
- Products don't show up
- Orders aren't working
- Any error messages you don't understand
What Information to Provide
- Your website URL
- What you were trying to do
- What error message you saw
- Screenshots if possible
- Device type (Android/iPhone)
Quick Self-Help Checklist
- ✅ Is your website online and working?
- ✅ Is the URL in
.env
file correct? - ✅ Can you login on your website?
- ✅ Do you have products on your website?
- ✅ Is your internet connection working?
📚 Additional Resources
Helpful Links
- API Documentation: https://ecommerce-api.botble.com/docs
- Quick Setup Guides: Check guides 01-15 in this documentation
- Social Login Setup: Check guides 12-15 for social authentication
Related Documentation
- Configuration Guide - Basic app setup
- Development Guide - Customizing your app
- Troubleshooting - Common problems and solutions
Remember: API integration connects your mobile app to your website. If you're not technical, don't hesitate to ask your developer for help!