<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Api-Design on Java &amp; Software Architecture Knowledge Hub</title><link>https://samirsahoo.github.io/design-patterns-hub/tags/api-design/</link><description>Recent content in Api-Design on Java &amp; Software Architecture Knowledge Hub</description><generator>Hugo</generator><language>en-US</language><copyright>© 2026 Samir Kumar Sahoo (https://github.com/samirsahoo). All rights reserved.</copyright><atom:link href="https://samirsahoo.github.io/design-patterns-hub/tags/api-design/index.xml" rel="self" type="application/rss+xml"/><item><title>RESTful API Design and Global Exception Handling</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/web/rest-api-design-and-error-handling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/web/rest-api-design-and-error-handling/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;RESTful API&lt;/strong&gt; exposes &lt;strong&gt;resources&lt;/strong&gt; (orders, customers) at stable URIs and uses &lt;strong&gt;HTTP methods and status codes&lt;/strong&gt; with their standard meanings. &lt;strong&gt;Global exception handling&lt;/strong&gt; turns every error into a &lt;strong&gt;consistent, machine-readable response&lt;/strong&gt;, in Spring using &lt;code&gt;@RestControllerAdvice&lt;/code&gt; and &lt;strong&gt;RFC 9457 Problem Details&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>REST vs GraphQL vs gRPC vs Messaging</title><link>https://samirsahoo.github.io/design-patterns-hub/comparisons/rest-graphql-grpc/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/comparisons/rest-graphql-grpc/</guid><description>&lt;h2 id="the-short-answer"&gt;The short answer&lt;a class="heading-anchor" href="#the-short-answer" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;&lt;/th&gt;&#10; &lt;th&gt;REST&lt;/th&gt;&#10; &lt;th&gt;GraphQL&lt;/th&gt;&#10; &lt;th&gt;gRPC&lt;/th&gt;&#10; &lt;th&gt;Messaging (Kafka, RabbitMQ)&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Style&lt;/td&gt;&#10; &lt;td&gt;Resources + HTTP verbs&lt;/td&gt;&#10; &lt;td&gt;Client-specified query over one endpoint&lt;/td&gt;&#10; &lt;td&gt;Remote procedure calls from a &lt;code&gt;.proto&lt;/code&gt; contract&lt;/td&gt;&#10; &lt;td&gt;Asynchronous events or commands&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Payload&lt;/td&gt;&#10; &lt;td&gt;Usually JSON&lt;/td&gt;&#10; &lt;td&gt;JSON&lt;/td&gt;&#10; &lt;td&gt;Protocol Buffers (binary)&lt;/td&gt;&#10; &lt;td&gt;Any (Avro, Protobuf, JSON)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Transport&lt;/td&gt;&#10; &lt;td&gt;HTTP/1.1, 2, 3&lt;/td&gt;&#10; &lt;td&gt;HTTP (POST/GET), WebSocket for subscriptions&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;HTTP/2&lt;/strong&gt; only&lt;/td&gt;&#10; &lt;td&gt;Broker protocol&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Coupling in time&lt;/td&gt;&#10; &lt;td&gt;Synchronous&lt;/td&gt;&#10; &lt;td&gt;Synchronous&lt;/td&gt;&#10; &lt;td&gt;Synchronous (+ streams)&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Decoupled&lt;/strong&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;HTTP caching&lt;/td&gt;&#10; &lt;td&gt;Excellent (GET, ETags, CDNs)&lt;/td&gt;&#10; &lt;td&gt;Hard (POST, varied queries)&lt;/td&gt;&#10; &lt;td&gt;None built in&lt;/td&gt;&#10; &lt;td&gt;n/a&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Browser support&lt;/td&gt;&#10; &lt;td&gt;Native&lt;/td&gt;&#10; &lt;td&gt;Native&lt;/td&gt;&#10; &lt;td&gt;Needs gRPC-Web / Connect proxy&lt;/td&gt;&#10; &lt;td&gt;No (via a back end)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Streaming&lt;/td&gt;&#10; &lt;td&gt;SSE, chunked&lt;/td&gt;&#10; &lt;td&gt;Subscriptions&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Client, server and bidirectional&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Inherent&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Contract&lt;/td&gt;&#10; &lt;td&gt;OpenAPI (optional)&lt;/td&gt;&#10; &lt;td&gt;Schema (required, introspectable)&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;.proto&lt;/code&gt; (required, code-generated)&lt;/td&gt;&#10; &lt;td&gt;Schema registry (recommended)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Best for&lt;/td&gt;&#10; &lt;td&gt;Public APIs, CRUD, cacheable reads&lt;/td&gt;&#10; &lt;td&gt;Many clients with different data needs; aggregating back ends&lt;/td&gt;&#10; &lt;td&gt;Internal service-to-service, low latency, polyglot&lt;/td&gt;&#10; &lt;td&gt;Events, workflows, buffering, fan-out&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;ByteByteGo&amp;rsquo;s timeline of API styles (SOAP → REST → GraphQL → gRPC) makes the same point: each style emerged for a different set of problems; none replaced the others.&lt;/p&gt;</description></item></channel></rss>