-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.html
More file actions
218 lines (204 loc) · 6.89 KB
/
errors.html
File metadata and controls
218 lines (204 loc) · 6.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Error Responses - Circuit Auction API</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css" rel="stylesheet" />
<style>
body { padding-top: 70px; background-color: #f8f9fa; }
.navbar-brand { font-weight: bold; }
.main-content { padding: 2rem; }
pre { background: #f4f4f4; padding: 1rem; border-radius: 0.375rem; position: relative; }
.copy-btn { position: absolute; top: 0.5rem; right: 0.5rem; font-size: 0.8rem; }
.param-table th { background-color: #f8f9fa; }
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="index.html">Circuit Auction API v1.0</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="index.html">Home</a></li>
</ul>
</div>
</div>
</nav>
<div class="container main-content">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">API</a></li>
<li class="breadcrumb-item active" aria-current="page">Error Responses</li>
</ol>
</nav>
<h1>Error Responses</h1>
<p class="lead">Understanding API error responses and status codes.</p>
<!-- Standard Error Format -->
<div class="card mb-4">
<div class="card-header">
<h4 class="mb-0">Standard Error Format</h4>
</div>
<div class="card-body">
<p>All errors follow a consistent JSON structure:</p>
<pre><code class="language-json">{
"title": "Validation error",
"status": 400,
"detail": "The field 'email' is required",
"errors": {
"email": ["This field is required"]
}
}</code></pre>
</div>
</div>
<!-- HTTP Status Codes -->
<div class="card mb-4">
<div class="card-header">
<h4 class="mb-0">Common HTTP Status Codes</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table param-table">
<thead>
<tr>
<th>Code</th>
<th>Status</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>200</code></td>
<td>OK</td>
<td>Request successful</td>
</tr>
<tr>
<td><code>201</code></td>
<td>Created</td>
<td>Resource created successfully</td>
</tr>
<tr>
<td><code>204</code></td>
<td>No Content</td>
<td>Success with no response body (e.g., DELETE)</td>
</tr>
<tr class="table-warning">
<td><code>400</code></td>
<td>Bad Request</td>
<td>Invalid request data</td>
</tr>
<tr class="table-warning">
<td><code>401</code></td>
<td>Unauthorized</td>
<td>Authentication required or failed</td>
</tr>
<tr class="table-warning">
<td><code>403</code></td>
<td>Forbidden</td>
<td>Insufficient permissions</td>
</tr>
<tr class="table-warning">
<td><code>404</code></td>
<td>Not Found</td>
<td>Resource not found</td>
</tr>
<tr class="table-warning">
<td><code>422</code></td>
<td>Unprocessable Entity</td>
<td>Validation error</td>
</tr>
<tr class="table-warning">
<td><code>429</code></td>
<td>Too Many Requests</td>
<td>Rate limit exceeded</td>
</tr>
<tr class="table-danger">
<td><code>500</code></td>
<td>Internal Server Error</td>
<td>Server error</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Error Examples -->
<div class="card mb-4">
<div class="card-header">
<h4 class="mb-0">Error Examples</h4>
</div>
<div class="card-body">
<h5>Missing Required Field</h5>
<pre><code class="language-json">{
"title": "The field 'email' is required",
"status": 400
}</code></pre>
<h5 class="mt-4">Invalid Data Format</h5>
<pre><code class="language-json">{
"title": "Invalid email format",
"status": 422,
"errors": {
"email": ["Please enter a valid email address"]
}
}</code></pre>
<h5 class="mt-4">Permission Denied</h5>
<pre><code class="language-json">{
"title": "Access denied",
"status": 403,
"detail": "You do not have permission to perform this action"
}</code></pre>
<h5 class="mt-4">Resource Not Found</h5>
<pre><code class="language-json">{
"title": "Resource not found",
"status": 404,
"detail": "Order with ID 999 does not exist"
}</code></pre>
<h5 class="mt-4">Rate Limit Exceeded</h5>
<pre><code class="language-json">{
"title": "Rate limit exceeded",
"status": 429,
"detail": "Too many requests. Please try again later.",
"retry_after": 60
}</code></pre>
</div>
</div>
<!-- Rate Limiting -->
<div class="card mb-4">
<div class="card-header">
<h4 class="mb-0">Rate Limiting</h4>
</div>
<div class="card-body">
<p>API requests may be rate-limited based on IP address or access token.</p>
<h5>Response Headers</h5>
<ul>
<li><code>X-RateLimit-Limit</code> - Maximum requests per window</li>
<li><code>X-RateLimit-Remaining</code> - Remaining requests in current window</li>
<li><code>X-RateLimit-Reset</code> - Unix timestamp when limit resets</li>
</ul>
</div>
</div>
<a href="index.html" class="btn btn-outline-secondary">Back to API Home</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script>
document.querySelectorAll('pre code').forEach(block => {
const button = document.createElement('button');
button.className = 'btn btn-sm btn-outline-secondary copy-btn';
button.textContent = 'Copy';
button.onclick = () => {
navigator.clipboard.writeText(block.textContent);
button.textContent = 'Copied!';
setTimeout(() => button.textContent = 'Copy', 2000);
};
block.parentElement.appendChild(button);
});
</script>
</body>
</html>