🎯 පාඩමේ අරමුණු
මේ පාඩම ඉවර වෙද්දී ඔයාට:
- API එකක් plain English වලින් තේරුම් ගන්න පුළුවන් වෙයි
- Every day APIs use කරන විදිය recognize කරන්න පුළුවන් වෙයි
- AI tools APIs use කරන විදිය දැකගන්න පුළුවන් වෙයි
- Basic API vocabulary දැනගන්න පුළුවන් වෙයි
📖 API එක කුමක්ද?
API යනු Application Programming Interface.
Technical වගේ sound වෙනවා, but simple explanation එක මෙන්න:
Plain English වලින් API
API එකක් යනු service එකකින් ඔයාට කරන්න පුළුවන් actions menu එකක්.
Restaurant menu එකක් dishes order කරන්න පුළුවන් මොනවද list කරනවා වගේ, API එකක් software service එකකින් request කරන්න පුළුවන් operations මොනවද list කරනවා.
🍽️ Restaurant Menu Analogy එක (Expanded)
Menu නැතුව (API නැහැ):
- ඔයාම kitchen එකට යන්න ඕන
- Every dish cook කරන විදිය ඉගෙන ගන්න ඕන
- Ingredients හැමඑකම store කරලා තියෙන්නේ කොහෙද දැනගන්න ඕන
- Kitchen equipment තේරුම් ගන්න ඕන
Customer කෙනෙකුට ඒක impossible! Food විතරක් ඕන.
Menu එක්ක (API):
- Available options බලනවා
- ඕන දේ choose කරනවා
- Waiter ට order එක කියනවා
- Kitchen prepare කරනවා
- Exactly ask කළ දේ receive කරනවා
API එක menu එක. ඔයාට CAN ask කරන්න මොනවද HOW ask කරන්නද කියලා කියනවා.
🌍 Real-World API Examples
Realize නොකර constantly APIs use කරනවා:
Weather Apps
Weather API menu එකේ includes:
- Current temperature ගන්න
- Next 7 days forecast ගන්න
- Humidity සහ wind speed ගන්න
- Sunrise/sunset times ගන්න
Maps & Navigation
Maps API menu එකේ includes:
- Points අතර directions ගන්න
- Travel time calculate කරන්න
- Nearby restaurants find කරන්න
- Traffic conditions show කරන්න
Social Media
Payment Processing
🤖 AI APIs Use කරන විදිය
Phone එකෙන් ChatGPT හෝ Claude එක්ක chat කරනකොට, මෙන්න happen වෙන දේ:
┌──────────────────────────────────────────────────────────┐│ ││ 📱 ඔයාගේ Phone ││ │ ││ │ ඔයා type කරනවා: "Photosynthesis simply explain කරන්න"││ │ ││ ▼ ││ 🌐 Internet ││ │ ││ │ ඔයාගේ message OpenAI API එකට send වෙනවා ││ │ ││ ▼ ││ 🖥️ OpenAI Servers ││ │ ││ │ AI ඔයාගේ message process කරනවා ││ │ Response generate කරනවා ││ │ ││ ▼ ││ 🌐 Internet ││ │ ││ │ Response ආපහු send වෙනවා ││ │ ││ ▼ ││ 📱 ඔයාගේ Phone ││ │ ││ │ ඔයා දකිනවා: "Photosynthesis cooking වගේ..." ││ │└──────────────────────────────────────────────────────────┘Key Insight
AI ඔයාගේ phone එකේ run වෙන්නේ නැහැ. ඔයාගේ phone just API එකට answers ask කරනවා.
📋 API Vocabulary
| Term | Plain English | Example |
|---|---|---|
| Request | API එකට ඔයා send කරන දේ (ඔයාගේ order) | "London weather මොකක්ද?" |
| Response | ඔයාට receive වෙන දේ (ඔයාගේ food) | "London: 15°C, Partly Cloudy" |
| Endpoint | Specific action එකක specific URL එකක් | /api/weather, /api/forecast |
| API Key | ඔයාව identify කරන password | API-KEY: sk-abc123xyz789 |
| Rate Limit | Requests කීයක් කරන්න පුළුවන්ද | "Free: 100/day, Pro: 10,000/day" |
🔄 Request-Response Cycle එක
Every API interaction මේ pattern follow කරනවා:
1. CLIENT (ඔයා/ඔයාගේ app) │ │ REQUEST කරනවා │ "Tokyo weather ගන්න" │ ▼2. API ENDPOINT │ │ Request process කරනවා │ Data fetch කරනවා │ Response prepare කරනවා │ ▼3. CLIENT RESPONSE receive කරනවා │ │ "Tokyo: 25°C, Sunny, │ Humidity: 60%" │ ▼4. APP user ට data display කරනවා💡 Vibe Coding වලට APIs Matter වෙන්නේ ඇයි
1. Possible මොනවද දැනගන්න
APIs define කරනවා service එකකින් කරන්න පුළුවන් සහ බැරි මොනවද. API endpoint එකක් නැත්නම්, programmatically ඒක කරන්න බැහැ.
2. Better Prompt කරන්න
Weather API එකක් තියෙනවා කියලා දන්නකොට, AI ට ask කරන්න පුළුවන්:
3. Errors තේරුම් ගන්න
මොකක් හරි work නොකරන විට, often API issue එකක්:
- "API key invalid" → Wrong password
- "Rate limit exceeded" → Requests ගොඩක්
- "Endpoint not found" → Wrong address
4. Connected Apps Build කරන්න
Modern apps multiple APIs combine කරනවා:
- Weather API + Maps API = "Route එකේ weather"
- Payment API + Email API = "Purchase එකට පස්සේ receipt sent"
- AI API + Speech API = "Voice assistant"
📊 Encounter වෙන Common APIs
| Category | Example APIs | කරන දේ |
|---|---|---|
| AI/ML | OpenAI, Anthropic, Google AI | Text generation, image analysis |
| Weather | OpenWeatherMap, WeatherAPI | Weather data සහ forecasts |
| Maps | Google Maps, Mapbox | Directions, locations, maps |
| Payments | Stripe, PayPal | Transactions process කිරීම |
| SendGrid, Mailgun | Programmatically emails send කිරීම | |
| Social | Twitter, Facebook | Content post කිරීම, feeds read කිරීම |
| Storage | AWS S3, Cloudinary | Files සහ images store කිරීම |
| Auth | Auth0, Firebase Auth | User login systems |
🎮 Action එකේ API
API Understanding නැතුව:
"Weather app එකක් හදන්න"
(AI guess කරන්න ඕන ඔයා mean කරන්නේ මොකක්ද)
API Understanding එක්ක:
Behind scenes වෙන දේ තේරුම් ගත්තම second prompt AI ට clear direction දෙනවා.
✅ පාඩමේ සාරාංශය
එක Sentence එකෙන් API
API එකක් service එකකින් perform කරන්න ask කරන්න පුළුවන් actions menu එකක්.
Key Concepts:
| Term | Plain English |
|---|---|
| API | Available actions menu එකක් |
| Request | Ask කරන දේ |
| Response | Back ලැබෙන දේ |
| Endpoint | Specific action එකේ address |
| API Key | Service use කරන්න ඔයාගේ password |
| Rate Limit | Requests කරන්න පුළුවන් කීවතාවක් |
📝 Mini Quiz
📝 ඔයාගේ Understanding Check කරන්න
1/3What is an API in plain English?