Grokking the System Design Interview, Volume II
Vote
0% completed
Unique ID Generator: API Design
Step 4: API Specifications
The shape of this API decides how often clients have to call it, which turns out to matter more here than anything inside the service.
We expose one endpoint.
1. Generate IDs
POST /v1/ids- Headers:
Authorization: Bearer <token> - Request Body:
{ "type": "sortable", // or "opaque" "count": 1 // up to 1000 }
- Response:
200 OK
{ "type": "sortable", "ids": ["1922298559865028608"] }
Four decisions are worth stating out loud.
It is a POST, not a GET. A `GET
.....
.....
.....
Like the course? Get enrolled and start learning!