-
Notifications
You must be signed in to change notification settings - Fork 0
/
fullApiDoc.html.html
445 lines (424 loc) · 11.1 KB
/
fullApiDoc.html.html
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<html><head><base href="https://rielec.io/api-docs/full"><title>RIELEC Full API Documentation</title>
<style>
body {
font-family: 'Roboto', sans-serif;
line-height: 1.6;
color: #333;
margin: 0;
padding: 0;
display: flex;
min-height: 100vh;
}
.sidebar {
width: 250px;
background-color: #2c3e50;
color: #ecf0f1;
padding: 20px;
overflow-y: auto;
height: 100vh;
position: fixed;
}
.content {
flex-grow: 1;
padding: 20px;
max-width: 800px;
margin-left: 270px;
}
h1, h2, h3, h4 {
color: #2c3e50;
}
.sidebar h2 {
color: #ecf0f1;
}
.sidebar ul {
list-style-type: none;
padding: 0;
}
.sidebar ul li {
margin-bottom: 10px;
}
.sidebar a {
color: #ecf0f1;
text-decoration: none;
}
.sidebar a:hover {
text-decoration: underline;
}
code {
background-color: #f4f4f4;
border: 1px solid #ddd;
border-radius: 4px;
display: block;
padding: 10px;
white-space: pre-wrap;
}
.endpoint {
margin-bottom: 30px;
border-bottom: 1px solid #eee;
padding-bottom: 20px;
}
.method {
display: inline-block;
padding: 5px 10px;
border-radius: 3px;
font-weight: bold;
}
.get { background-color: #61affe; color: #fff; }
.post { background-color: #49cc90; color: #fff; }
.put { background-color: #fca130; color: #fff; }
.delete { background-color: #f93e3e; color: #fff; }
.patch { background-color: #50e3c2; color: #fff; }
.response {
margin-top: 10px;
}
.response h4 {
margin-bottom: 5px;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<div class="sidebar">
<h2>API Sections</h2>
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#authentication">Authentication</a></li>
<li><a href="#instances">Instances</a></li>
<li><a href="#instance-groups">Instance Groups</a></li>
<li><a href="#monitoring">Monitoring</a></li>
<li><a href="#users">Users</a></li>
<li><a href="#error-handling">Error Handling</a></li>
<li><a href="#rate-limiting">Rate Limiting</a></li>
<li><a href="#webhooks">Webhooks</a></li>
<li><a href="#sdks">SDKs and Libraries</a></li>
</ul>
</div>
<div class="content">
<h1>RIELEC Full API Documentation</h1>
<section id="introduction">
<h2>Introduction</h2>
<p>Welcome to the comprehensive RIELEC API documentation. This API allows you to programmatically manage your Docker instances, monitor performance, and integrate RIELEC with your existing tools and workflows.</p>
<p>Base URL: <code>https://api.rielec.io/v1</code></p>
</section>
<section id="authentication">
<h2>Authentication</h2>
<p>All API requests must be authenticated using an API key. Include your API key in the Authorization header:</p>
<code>Authorization: Bearer YOUR_API_KEY</code>
<p>To obtain an API key, log in to your RIELEC dashboard and navigate to Settings > API Keys.</p>
</section>
<section id="instances">
<h2>Instances</h2>
<div class="endpoint">
<h3><span class="method get">GET</span> /instances</h3>
<p>Retrieve a list of all instances.</p>
<h4>Query Parameters:</h4>
<table>
<tr><th>Parameter</th><th>Type</th><th>Description</th></tr>
<tr><td>limit</td><td>integer</td><td>Number of instances to return (default: 20, max: 100)</td></tr>
<tr><td>offset</td><td>integer</td><td>Offset for pagination (default: 0)</td></tr>
<tr><td>status</td><td>string</td><td>Filter by instance status (e.g., running, stopped)</td></tr>
</table>
<div class="response">
<h4>Response:</h4>
<code>
{
"instances": [
{
"id": "inst-123abc",
"name": "web-server-1",
"status": "running",
"image": "nginx:latest",
"created_at": "2023-06-15T10:30:00Z",
"resources": {
"cpu": 1,
"memory": 1024
}
},
...
],
"total": 50,
"limit": 20,
"offset": 0
}
</code>
</div>
</div>
<div class="endpoint">
<h3><span class="method post">POST</span> /instances</h3>
<p>Create a new instance.</p>
<h4>Request Body:</h4>
<code>
{
"name": "new-instance",
"image": "nginx:latest",
"resources": {
"cpu": 1,
"memory": 1024
},
"env": {
"KEY1": "VALUE1",
"KEY2": "VALUE2"
},
"group_id": "grp-789ghi" // Optional
}
</code>
<div class="response">
<h4>Response:</h4>
<code>
{
"id": "inst-456def",
"name": "new-instance",
"status": "creating",
"image": "nginx:latest",
"created_at": "2023-06-16T14:20:00Z",
"resources": {
"cpu": 1,
"memory": 1024
}
}
</code>
</div>
</div>
<div class="endpoint">
<h3><span class="method get">GET</span> /instances/{instance_id}</h3>
<p>Retrieve details of a specific instance.</p>
<div class="response">
<h4>Response:</h4>
<code>
{
"id": "inst-123abc",
"name": "web-server-1",
"status": "running",
"image": "nginx:latest",
"created_at": "2023-06-15T10:30:00Z",
"resources": {
"cpu": 1,
"memory": 1024
},
"env": {
"KEY1": "VALUE1",
"KEY2": "VALUE2"
},
"group_id": "grp-789ghi"
}
</code>
</div>
</div>
<div class="endpoint">
<h3><span class="method put">PUT</span> /instances/{instance_id}</h3>
<p>Update an existing instance.</p>
<h4>Request Body:</h4>
<code>
{
"name": "updated-instance-name",
"resources": {
"cpu": 2,
"memory": 2048
}
}
</code>
<div class="response">
<h4>Response:</h4>
<code>
{
"id": "inst-123abc",
"name": "updated-instance-name",
"status": "running",
"image": "nginx:latest",
"created_at": "2023-06-15T10:30:00Z",
"updated_at": "2023-06-16T15:45:00Z",
"resources": {
"cpu": 2,
"memory": 2048
}
}
</code>
</div>
</div>
<div class="endpoint">
<h3><span class="method delete">DELETE</span> /instances/{instance_id}</h3>
<p>Delete an instance.</p>
<div class="response">
<h4>Response:</h4>
<code>
{
"message": "Instance successfully deleted"
}
</code>
</div>
</div>
</section>
<section id="instance-groups">
<h2>Instance Groups</h2>
<div class="endpoint">
<h3><span class="method get">GET</span> /instance-groups</h3>
<p>Retrieve a list of all instance groups.</p>
<div class="response">
<h4>Response:</h4>
<code>
{
"groups": [
{
"id": "grp-789ghi",
"name": "web-servers",
"instance_count": 5,
"created_at": "2023-06-10T09:00:00Z"
},
...
]
}
</code>
</div>
</div>
<div class="endpoint">
<h3><span class="method post">POST</span> /instance-groups</h3>
<p>Create a new instance group.</p>
<h4>Request Body:</h4>
<code>
{
"name": "new-group",
"description": "A group for new instances"
}
</code>
<div class="response">
<h4>Response:</h4>
<code>
{
"id": "grp-101jkl",
"name": "new-group",
"description": "A group for new instances",
"instance_count": 0,
"created_at": "2023-06-16T16:00:00Z"
}
</code>
</div>
</div>
</section>
<section id="monitoring">
<h2>Monitoring</h2>
<div class="endpoint">
<h3><span class="method get">GET</span> /instances/{instance_id}/metrics</h3>
<p>Retrieve metrics for a specific instance.</p>
<h4>Query Parameters:</h4>
<table>
<tr><th>Parameter</th><th>Type</th><th>Description</th></tr>
<tr><td>start_time</td><td>string</td><td>Start time for metrics (ISO 8601 format)</td></tr>
<tr><td>end_time</td><td>string</td><td>End time for metrics (ISO 8601 format)</td></tr>
<tr><td>metric</td><td>string</td><td>Comma-separated list of metrics (e.g., cpu,memory,network)</td></tr>
</table>
<div class="response">
<h4>Response:</h4>
<code>
{
"instance_id": "inst-123abc",
"metrics": {
"cpu": [
{"timestamp": "2023-06-16T10:00:00Z", "value": 45.2},
{"timestamp": "2023-06-16T10:01:00Z", "value": 48.7},
...
],
"memory": [
{"timestamp": "2023-06-16T10:00:00Z", "value": 512.3},
{"timestamp": "2023-06-16T10:01:00Z", "value": 524.1},
...
]
}
}
</code>
</div>
</div>
</section>
<section id="users">
<h2>Users</h2>
<div class="endpoint">
<h3><span class="method get">GET</span> /users</h3>
<p>Retrieve a list of users (requires admin privileges).</p>
<div class="response">
<h4>Response:</h4>
<code>
{
"users": [
{
"id": "usr-246abc",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d8b2b7b0b698bda0b9b5a8b4bdf6bbb7b5">[email protected]</a>",
"role": "admin",
"created_at": "2023-05-01T09:00:00Z"
},
...
]
}
</code>
</div>
</div>
<div class="endpoint">
<h3><span class="method post">POST</span> /users</h3>
<p>Create a new user (requires admin privileges).</p>
<h4>Request Body:</h4>
<code>
{
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="48262d3f3d3b2d3a082d30292538242d662b2725">[email protected]</a>",
"password": "securepassword123",
"role": "user"
}
</code>
<div class="response">
<h4>Response:</h4>
<code>
{
"id": "usr-357def",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7b151e0c0e081e093b1e031a160b171e55181416">[email protected]</a>",
"role": "user",
"created_at": "2023-06-16T17:30:00Z"
}
</code>
</div>
</div>
</section>
<section id="error-handling">
<h2>Error Handling</h2>
<p>The API uses conventional HTTP response codes to indicate the success or failure of an API request. In general:</p>
<ul>
<li>2xx range indicate success</li>
<li>4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, etc.)</li>
<li>5xx range indicate an error with RIELEC's servers</li>
</ul>
<p>Error Response Format:</p>
<code>
{
"error": {
"code": "error_code",
"message": "A human-readable message providing more details about the error."
}
}
</code>
</section>
<section id="rate-limiting">
<h2>Rate Limiting</h2>
<p>The RIELEC API implements rate limiting to ensure the stability and availability of the service for all users. The current limits are:</p>
<ul>
<li>1000 requests per hour for authenticated users</li>
<li>50 requests per hour for unauthenticated requests</li>
</ul>
<p>Rate limit information is included in the response headers:</p>
<code>
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1623884461
</code>
</section>
<section id="webhooks">
<h2>Webhooks</h2>
<p>RIELEC provides webhooks to notify your application about events in real-time. To set up a webhook:</p>
<div class="endpoint">
<h3><span class="metho<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script>