Rest Basics w/Postman vs GraphQL

June 20, 2025

3 min read

REST API

REST is the most common communication standard for computers over the Internet. REST stands for Representational State Transfer. It's a loose set of rules, which together provide a common standard for building web APIs.

Here are the key principles: Resources are organized into URIs, which look like this:

chain

Requests to the API begin with one of five HTTP methods: GET, POST, PATCH, PUT, or DELETE. You might hear these referred to as "CRUD". Responses from the server begin with an HTTP response code. Generally, this is 200 for a success, 400 for a client-side error, and 500 for an internal server error.

Calls to the API are stateless, which means calls from different clients do not have any reference to each other. If the REST API returns huge amounts of data, that should be done through pagination. This essentially means that a user could call an API, get a partial result along with a token that indicates where the next page is, then use that token to request the rest.

Finally, APIs should be versioned. Anytime a breaking change is released, you need to create a new version of your API so that none of your consumers are affected by the update.

•••

REST, "Representational State Transfer", internet üzerindeki bilgisayarlar arasında en yaygın iletişim standartlarından biridir.Web API'leri oluşturmak için ortak bir standart sunan kurallar bütünüdür.

Temel ilkeler şunlar: Kaynaklar URI’lar (Uniform Resource Identifier) üzerinden organize edilir; yani URL benzeri yapılardır. API'ye yapılan istekler beş temel HTTP metodu ile başlar: GET, POST, PATCH, PUT veya DELETE. Bu metodlar genellikle “CRUD” olarak biliriz.

Sunucudan gelen yanıtlar bir HTTP yanıt kodu ile başlar. Genellikle 200 başarı, 400 istemci taraflı hata, 500 ise sunucu taraflı hata anlamına gelir. REST API'leri stateless’tır, yani her istek bağımsız. Bir kullanıcının yaptığı çağrı diğerini etkilemez ya da referans almaz. Eğer API çok fazla veri döndürecekse, bu işlem sayfalama (pagination) ile yapılmalıdır. Yani kullanıcı ilk çağrıda verinin bir kısmını alır, yanında bir “token” gelir ve bu token ile bir sonraki sayfayı talep edebilir.

Son olarak, API'lerin versiyonlanması gerekir. API’ye geriye dönük uyumsuz (breaking) bir değişiklik yapıldığında, yeni bir versiyon oluşturulmalıdır ki mevcut kullanıcılar etkilenmesin.


Postman

Postman is a super popular development tool that simplifies the process of building and testing APIs. Postman provides a user-friendly, easy to use interface where developers can construct API requests, send them directly to the server, and inspect the results - all within Postman.

Let’s say you’re working on a web app that integrates with a third-party API to collect user data. You want to test the GET endpoint to make sure you can retrieve user data correctly using just a user ID. All you have to do is open Postman, create the request, add any necessary headers, and then send the request directly from the app. After that, you’ll receive an HTTP response code along with the response body, which is most likely in JSON format.

•••

Postman, API geliştirme ve test süreçlerini kolaylaştıran, oldukça yaygın kullanılan bir araç. Geliştiriciler için kullanıcı dostu ve kullanımı kolay bir arayüz sunar; bu arayüz üzerinden API istekleri oluşturabilir, doğrudan sunucuya gönderebilir ve gelen yanıtları yine Postman içinde görüntüleyebilirsin.

Diyelim ki bir web uygulaması üzerinde çalışıyorsun ve bu uygulama dış kaynaklı bir API’den kullanıcı verisi çekiyor. Bu durumda, sadece kullanıcı ID’si ile veri çekebildiğini test etmek istiyorsun, yani GET endpoint’ini deneyeceksin. Yapman gereken şey çok basit: Postman’i aç, isteği oluştur, gerekiyorsa header gibi ek detayları gir ve isteği gönder. Ardından bir HTTP durum kodu ve büyük ihtimalle JSON formatında bir yanıt göreceksin.


GraphQL

GraphQL is a query language for APIs and a runtime for those APIs that allows users to specify exactly the data they need and receive just that.

Here are a few of the key features: GraphQL only has a single endpoint for users to access. Within this endpoint, users can specify exactly which fields they want to retrieve from your API. This means that whenever you make a request, you only get back exactly what you ask for. When used correctly, this can save a lot of network bandwidth and lead to more flexible and efficient responses from the API.

GraphQL also doesn’t need to follow the same versioning structure as REST APIs. That’s because its schema is flexible - you can add new fields in real-time, and users can query them without breaking older clients still using the existing fields.

•••

GraphQL, API'ler için bir sorgulama dili ve aynı zamanda bu API’lerin çalışmasını sağlayan bir runtime’dır. Kullanıcının sadece ihtiyacı olan veriyi belirtmesini ve sadece o veriyi almasını sağlar.

GraphQL genellikle tek bir endpoint üzerinden çalışır. Bu endpoint üzerinden kullanıcılar hangi alanları çekmek istediklerini net bir şekilde belirleyebilir. Yani bir istek yaptığında, sadece istediğin alanlar sana geri döner, ne fazla ne eksik. Bu da doğru kullanıldığında ciddi ölçüde ağ trafiği (bandwidth) tasarrufu sağlar ve API yanıtlarının daha esnek ve verimli olmasını sağlar.

Ayrıca GraphQL, REST API'lerdeki gibi klasik versiyonlama sistemine ihtiyaç duymaz. Çünkü GraphQL’in şeması esnektir, yeni alanları sonradan ekleyebilir ve kullanıcılar bunları sorgulayabilir; bu da eski alanları kullanan sistemleri bozmadan ilerlemeni sağlar.