APIとは
リクエストとレスポンスを理解します。
「APIとは」はCoddyKit上の無料Vibe Codingレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはVibe Coding学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Vibe Codingコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Why APIs Matter
An API (Application Programming Interface) is how one program talks to another. Instead of rebuilding maps, payments, or weather data yourself, you call someone else's service and get the answer back.
When you build software with an AI assistant, most real features come from connecting to third-party APIs. Learning to think in APIs lets you assemble powerful apps quickly.
A Restaurant Analogy
Think of an API like a restaurant menu. You don't go into the kitchen and cook. You read the menu, place an order with the waiter, and food arrives.
The menu is the API documentation, your order is the request, and the dish is the response. You never see how the kitchen works inside, only what it promises to deliver.
Requests and Responses
Every API interaction has two halves: a request you send and a response you receive. The request says what you want; the response carries the data or a status.
You can ask your AI assistant to explain this flow for any service you plan to use, so you know exactly what to send and what comes back.
Explain how a request and response work for the OpenWeatherMap API.
Show me one example request and what the response looks like.Endpoints Are Addresses
An endpoint is a specific URL where the API listens for one kind of request. A weather service might have one endpoint for current conditions and another for forecasts.
Each endpoint does a focused job. Knowing which endpoint to hit is half the battle when integrating any external service into your app.
HTTP Methods
APIs use HTTP methods to signal intent. GET fetches data, POST creates something, PUT or PATCH updates, and DELETE removes. The method tells the server what action you mean.
When unsure, ask your assistant which method an endpoint expects. Picking the wrong one is a common beginner mistake that returns confusing errors.
For the GitHub API, which HTTP method do I use to create a new issue,
and which one do I use to just read existing issues?JSON: The Common Language
Most modern APIs speak JSON, a lightweight text format of keys and values. A weather response might include "temp": 21 and "city": "Paris".
JSON is easy for both humans and code to read. Your AI assistant can turn a raw JSON response into clean variables your app actually uses.
Here is a JSON response from a weather API.
Show me how to pull out the temperature and city name in JavaScript.API Keys: Your ID Badge
Many APIs require an API key, a unique string that identifies and authorizes you. It is like an ID badge that lets you through the door and tracks your usage.
Keys are secret. Never paste them into public code or share them in chat. We will cover safe handling in a later lesson.
Rate Limits
APIs limit how many requests you can make in a time window, called a rate limit. Free tiers might allow 60 calls per minute, paid tiers far more.
Hitting the limit returns an error, not your data. Ask your assistant to check a service's limits before you build features that call it in a loop.
What are the free-tier rate limits for the TheMovieDB API,
and how should I structure my app to stay under them?Status Codes Tell a Story
Every response carries a status code. 200 means success, 401 means unauthorized, 404 means not found, and 429 means too many requests.
These numbers are your fastest debugging clue. When something breaks, the status code usually points straight at the cause before you read any error text.
Public vs Private APIs
Some APIs are public and free, like many weather or quote services. Others are private, needing accounts, billing, or approval, like payment and messaging platforms.
Knowing which kind you face shapes your setup. Ask your assistant to compare options so you start with the simplest service that meets your need.
I want to add quotes to my app. Suggest three free, no-signup APIs
and compare their ease of use for a beginner.Thinking in Integrations
Building with AI is mostly about wiring services together. A trip planner might combine a maps API, a weather API, and a currency API into one screen.
Once you see features as integrations, you describe the outcome to your assistant and let it handle the plumbing of requests, parsing, and display.
Quick Check
Test your understanding of API basics.
Recap
An API lets your app borrow another service's powers through requests and responses. You hit endpoints with HTTP methods, send and receive JSON, and identify yourself with keys.
Status codes and rate limits guide your debugging. Next, you will learn to read API docs quickly with help from your AI assistant.
AI チューターと学ぶ JavaScript — 無料
ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。
- コース
- 25
- レッスン
- 100
よくある質問
「APIとは」レッスンは無料ですか?
はい。「APIとは」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Vibe Codingコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Vibe Codingコースには全4レッスンが含まれています。
「APIとは」で何を学びますか?
リクエストとレスポンスを理解します。 ブラウザで直接実行するハンズオンコードでVibe Codingを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Vibe Codingを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのVibe Codingは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。
「APIとは」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このVibe Codingレッスンでコードを書いて実行できますか?
はい。すべてのVibe Codingレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。