Bir API'den GET Verisi Alın
Bir HTTP isteği gönderin ve yanıtı okuyun.
Bir API'den GET Verisi Alın, CoddyKit'te ücretsiz bir Arduino & IoT Academy dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Arduino & IoT Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Arduino & IoT Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
The Web Is Just Requests
Your board can pull data from the internet the same way a browser does: by making an HTTP request to a URL. 🌐
What GET Means
A GET request asks a server, please send me this data. It only reads, it never changes anything on the other side.
You Need a Connection First
Before any request, your ESP must already be on WiFi. Without a network connection there is nowhere to send the request.
Include HTTPClient
The HTTPClient library gives you simple functions to make requests. Include it at the top of your sketch.
#include <HTTPClient.h>Create the Client
Make an HTTPClient object, then point it at your target URL with begin(). This sets up the request you are about to send.
HTTPClient http;
http.begin("http://api.example.com/data");Send the GET
Call GET() to fire the request. It returns an HTTP status code that tells you whether the server liked your request.
int code = http.GET();Check the Status Code
A code of 200 means success. Always check it before trusting the data, since 404 or 500 means something went wrong.
if (code == 200) {
// good response
}Read the Response Body
When the status is good, grab the actual data with getString(). This is the text the server sent back to you.
String body = http.getString();Always Free the Connection
Call end() when you are done. This closes the connection and frees memory so the next request starts clean.
http.end();Negative Codes Are Local
A negative status code does not come from the server. It means the request failed on your side, often no WiFi or a bad URL.
Do Not Hammer the Server
Add a delay between requests so you do not flood the API. Most services limit how often you may ask for data.
Quick Check
Your code received an HTTP status of 200. What does that tell you?
Recap
You connected, called GET(), checked for 200, read the body with getString(), and closed with end(). That is a full read from the web. 🎉
Sıkça Sorulan Sorular
“Bir API'den GET Verisi Alın” dersi ücretsiz mi?
Evet — “Bir API'den GET Verisi Alın” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Arduino & IoT Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Arduino & IoT Academy kursu toplamda 4 dersten oluşur.
“Bir API'den GET Verisi Alın” dersinde ne öğreneceğim?
Bir HTTP isteği gönderin ve yanıtı okuyun. Arduino & IoT Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Arduino & IoT Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Arduino & IoT Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.
“Bir API'den GET Verisi Alın” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Arduino & IoT Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Arduino & IoT Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Bir API'den GET Verisi Alın
- Sensör Ölçümlerini POST ile Gönderin
- JSON Yanıtlarını Ayrıştırın
- HTTPS'yi Güvenli Kullanın