Idempotent
- Idempotent key
stateless
Rest(Http) API Design
Hackable, intuitive url
Service health check APIs
Caching
Time-based cache headers
Conditional cache headers
- ETag and If-Modified-Since, If-None-Match
- request.evaluatePreconditions(tag)
Add X-Request-ID to request
Versioning
- Accept: application/json; version=3
Rate limit
Security, Auth
Audit
Use plural noun
GET /api/dogs/{id}
GET /api/dogs/?name=xxx
Relationship
/{relationship-name}[/{resource-id}]/…/{relationship-name}[/{resource-id}]
GET /persons/1/dogs
Query
GET /persons;id=1/dogs GET /persons;name=blabla/dogs
GET /dogs?color=red&state=running&location=park
Partial Fields
/dogs?fields=name,color,location
Actions
/resources/:resource/actions/:action
"kind": "Dog"
"ownerID": "98765432",
"kind": "Collection",
hypermedia - HATEOAS
"ownerLink": "https://dogtracker.com/persons/98765432"
selfLink
"self": "https://dogtracker.com/dogs?limit=25,offset=0",
"kind": "Page",
"pageOf": "https://dogtracker.com/dogs",
"next": "https://dogtracker.com/dogs?limit=25,offset=25",
201 Created
301 Moved Permanently
304 Not Modified
401 Unauthorized