REST Resource Model

REST 자원 모델

URIs identify resources while HTTP methods express reading, creating, and changing them.

···
html
<div class="viz"><h3>RESOURCE /orders/42</h3><div class="row"><span class="box code" id="method">GET</span><span class="arrow">→</span><span class="box" id="resource">order 42<br><b class="accent">read</b></span></div><div class="muted" id="reply">200 · representation</div></div>
css
.viz{width:94%;height:88%;max-width:960px;padding:clamp(10px,2vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);font:600 clamp(12px,1.35vw,16px)/1.35 var(--font-sans,system-ui,sans-serif);display:flex;flex-direction:column;gap:clamp(7px,1.8vmin,13px);overflow:hidden}.viz h3{margin:0;color:var(--accent);font:700 clamp(12px,1.35vw,16px)/1.2 var(--font-sans,system-ui,sans-serif);letter-spacing:.04em}.viz .row{display:flex;align-items:center;justify-content:center;gap:clamp(5px,1.4vmin,12px);flex:1;min-height:0}.viz .box{padding:clamp(5px,1.5vmin,12px);border:1px solid var(--line);border-radius:9px;background:var(--bg);text-align:center}.viz .muted{color:var(--muted)}.viz .accent{color:var(--accent)}.viz .code{font-family:ui-monospace,monospace}.viz .pill{padding:3px 7px;border:1px solid var(--line);border-radius:99px;white-space:nowrap}.viz .active{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,var(--surface))}.viz .arrow{color:var(--accent);font:700 18px ui-monospace,monospace}.row .box{min-width:30%}#resource{transition:transform .35s,background .35s}#resource.bump{transform:scale(1.08);background:color-mix(in srgb,var(--accent) 15%,var(--surface))}
js
const steps=[['GET','read','200 · representation'],['PATCH','changed','200 · updated'],['DELETE','removed','204 · no content']];let i=0;function draw(){const [method,state,reply]=steps[i];document.getElementById('method').textContent=method;document.querySelector('#resource b').textContent=state;document.getElementById('reply').textContent=reply;const box=document.getElementById('resource');box.classList.remove('bump');void box.offsetWidth;box.classList.add('bump');i=(i+1)%steps.length}draw();setInterval(draw,1400)

In a REST-style API, a URI such as /orders/42 identifies an order resource. GET reads its representation, POST creates within a collection, and PATCH applies a specified change. Clients need not learn a new verb in every URI.

The demo applies methods to one resource and changes its visible state. Document method semantics and response codes in the contract, and avoid exposing internal implementation structure directly in the URI.

When to use

Use it when designing consistent paths and methods for an HTTP resource API.

Open as page ↗