What makes an interface RESTful?
REST requires client–server separation, stateless requests, cache rules, a uniform interface and a layered system; downloading executable code is optional. Statelessness means each request supplies its necessary context, not that the service cannot store quotes or portfolios.
Reading is different from repeating
| Method | Safe? | Idempotent by HTTP semantics? |
|---|---|---|
| GET | Yes | Yes |
| PUT | No | Yes |
| DELETE | No | Yes |
| POST | No | No general guarantee |
429 with an optional Retry-After; respect the provider’s policy and bound retry attempts. RFC 6585 §4 defines that rate-limit response.A quote fixture is only the body stage
/v1/quotes/ABC. A GET would request a representation of that resource. The following Python example starts with an authored string; it makes no HTTP request and is not a captured provider response. The price is a decimal string by this fictional schema’s design.import json
from decimal import Decimal
body = '{"symbol":"ABC","price":"100.00","currency":"USD"}'
quote = json.loads(body)
if quote["symbol"] != "ABC" or quote["currency"] != "USD":
raise ValueError("unexpected instrument or currency")
price = Decimal(quote["price"])
if not price.is_finite() or price <= 0:
raise ValueError("price must be finite and positive")
quantity = 2
mark = quantity * price
print(f"{quantity} units at USD {price:.2f} = USD {mark:.2f}")
# 2 units at USD 100.00 = USD 200.00The fictional holding is two units, each marked at USD 100, so its mark is USD 200 before fees or currency conversion. Decoding turns text into Python objects; it does not establish economic meaning. This narrow example assumes the documented fields and types. A live client must also enforce its complete schema, check quote time and timezone, instrument identity, price units and currency, and distinguish missing data from zero.
For live access, use HTTPS, protected credentials and finite timeouts; inspect status and content type before decoding. Apply cache permissions and freshness rules, follow documented pagination, and record request parameters, retrieval time and the response snapshot used by research. The same resource URL can produce a changed quote later.
Continue with an ingestion boundary
Sources
- Roy Fielding, dissertation Chapter 5: REST, especially §§5.1–5.2.
- IETF RFC 9110: HTTP Semantics, §§9.2–9.3.
- IETF RFC 6585 §4: 429 Too Many Requests.
- Python 3.14 documentation: JSON decoding. The offline example was executed with Python 3.14.4.
- Python 3.14 documentation: decimal and finite-value checks.