forked from nodester/nodester
/
api.html
516 lines (500 loc) · 25.8 KB
/
api.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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Nodester -> Open Source Node.JS PaaS</title>
<meta name="description" content="Open Source Node.JS Platform as a Service" />
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="bootstrap.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
padding-top: 60px;
}
</style>
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="images/nodester_favicon.ico" />
<link rel="apple-touch-icon" href="images/apple-touch-icon.png" />
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://twitter.github.com/bootstrap/1.4.0/bootstrap-tabs.js"></script>
<script type="text/javascript" src="/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2483685-22']);
_gaq.push(['_setDomainName', 'nodester.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<script>
$(document).ready(function() {
var hash = window.location.hash.substring(1);
if (hash == "rest") {
$('#clili').removeClass("active");
$('#cli').removeClass("active");
$('#restli').addClass("active");
$('#rest').addClass("active");
}
if (hash == "explorer") {
$('#clili').removeClass("active");
$('#cli').removeClass("active");
$('#explorerli').addClass("active");
$('#explorer').addClass("active");
}
});
</script>
<div class="topbar">
<div class="fill">
<div class="container">
<a class="brand" href="index.html"><img src="images/rocket-md-right.png" width="20" /> nodester</a>
<ul class="nav">
<li><a href="index.html">Home</a></li>
<li class="active"><a href="api.html">API</a></li>
<li><a href="help.html">Help</a></li>
<li><a href="http://irc.nodester.com">IRC</a></li>
<li><a href="http://blog.nodester.com">Blog</a></li>
</ul>
<p class="pull-right">
<form action="http://admin.nodester.com/login" method="post" class="pull-right">
<input class="input-small" type="text" placeholder="Username" name="user[user]" />
<input class="input-small" type="password" placeholder="Password" name="user[pass]" />
<button class="btn" type="submit">Sign in</button>
</form>
</p>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span16">
<br />
<h1>Nodester API Documentation</h1>
<p>Our entire platform is built on a set of REST APIs. A subset of these APIs are implemented in our CLI (command line interface).
We are also working on a web admin panel based on these APIs which will eventually allow you to provision, monitor, and control
Node.JS applications running on the Nodester platform without going to the command line.
</p>
<ul class="tabs" data-tabs="tabs">
<li id="clili" class="active"><a href="#cli">Command Line Interface (CLI)</a></li>
<li id="restli"><a href="#rest">REST API</a></li>
<li id="explorerli"><a href="#explorer">API Explorer</a></li>
</ul>
<div id="my-tab-content" class="tab-content">
<div class="active tab-pane" id="cli">
<p>
Our command line interface allows you to manage your user account and applications with simple commands. Before you can begin using
these commands, you need to install the Nodester CLI using NPM.
</p>
<p>
<b>npm install nodester-cli -g</b>
</p>
<br />
<table class="bordered-table zebra-striped">
<tr>
<td><b>coupon</b></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>nodester coupon <email address></td>
</tr>
<tr>
<td><b>user</b></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>nodester user create <username> <password> <email address> <file containing ssh public key> <coupon code></td>
</tr>
<tr>
<td> </td>
<td>nodester user setup <username> <password></td>
</tr>
<tr>
<td> </td>
<td>nodester user setkey <file containing ssh public key></td>
</tr>
<tr>
<td> </td>
<td>nodester user setpass sendtoken</td>
</tr>
<tr>
<td> </td>
<td>nodester user setpass <token> <new_password></td>
</tr>
<tr>
<td><b>apps</b></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>nodester apps list</td>
</tr>
<tr>
<td><b>app</b></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>nodester app create <appname> <initial js file></td>
</tr>
<tr>
<td> </td>
<td>nodester app info <appname></td>
</tr>
<tr>
<td> </td>
<td>nodester app logs <appname></td>
</tr>
<tr>
<td> </td>
<td>nodester app start <appname></td>
</tr>
<tr>
<td> </td>
<td>nodester app restart <appname></td>
</tr>
<tr>
<td> </td>
<td>nodester app stop <appname></td>
</tr>
<tr>
<td> </td>
<td>nodester app gitreset <appname></td>
</tr>
<tr>
<td><b>npm</b></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>nodester npm list <appname></td>
</tr>
<tr>
<td> </td>
<td>nodester npm install <appname> <packages></td>
</tr>
<tr>
<td> </td>
<td>nodester npm update <appname> <packages></td>
</tr>
<tr>
<td> </td>
<td>nodester npm uninstall <appname> <packages></td>
</tr>
<tr>
<td><b>env</b></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>nodester env get <appname></td>
</tr>
<tr>
<td> </td>
<td>nodester env set <appname> <key> <value></td>
</tr>
<tr>
<td> </td>
<td>nodester env delete <appname> <key></td>
</tr>
<tr>
<td><b>domain</b></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>nodester domain</td>
</tr>
<tr>
<td><b>status</b></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>nodester status</td>
</tr>
</table>
<p>
If you would like to contribute to our open source Nodester CLI on <a href="https://github.com/nodester/nodester-cli">GitHub</a>, please send us pull requests :)
</p>
</div>
<div class="tab-pane" id="rest">
<p>
The force is strong with our REST API.
</p>
<p>
<b>Base URL: http://api.nodester.com</b>
</p>
<br />
<table class="bordered-table zebra-striped">
<tr>
<td><b>coupon</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled success">POST</a></td>
<td><b>/coupon</b> - Creates coupon request for early access (pass in email)<br />
<code>curl -X POST -d "email=your_address@gmail.com" http://nodester.com/coupon</code>
</td>
</tr>
<tr>
<td><b>user</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled success">POST</a></td>
<td><b>/user</b> - Creates user account (pass in user and password and email and id_rsa.pub string) <i>Ensure that all + in the ssh key are substituted for their %2B counter parts, else your key will break. Run this on your command line to copy your RSA string and swap out the plus signs: "cat ~/.ssh/id_rsa.pub | sed s/'+'/'%2B'/g | pbcopy"</i><br />
<code>curl -X POST -d "coupon=mycoupon&user=testuser&password=123&email=chris@nodester.com&rsakey=ssh-rsa AAAAB3NzaC1yc..." http://nodester.com/user</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled">PUT</a></td>
<td><b>/user</b> - Updates user account (pass in password and/or RSA key - "cat ~/.ssh/id_rsa.pub | sed s/'+'/'%2B'/g | pbcopy")<br />
<code>curl -X PUT -u "testuser:123" -d "password=test" http://api.nodester.com/user</code><br />
<code>curl -X PUT -u "testuser:123" -d "rsakey=1234567" http://api.nodester.com/user</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled danger">DELETE</a></td>
<td><b>/user</b> - Deletes user account (requires basic auth)<br />
<code>curl -X DELETE -u "testuser:123" http://api.nodester.com/user</code>
</td>
</tr>
<tr>
<td><b>apps</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled primary">GET</a></td>
<td><b>/apps</b> - Returns a list of all apps created by a user account (requires basic auth)<br />
<code>curl -X GET -u "testuser:123" http://nodester.com/apps</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled success">POST</a></td>
<td><b>/apps/<appname></b> - Creates nodejs app for hosting (requires basic auth and returns the port address required for use along with a git repo to push to)<br />
<code>curl -X POST -u "testuser:123" -d "start=hello.js" http://api.nodester.com/apps/a</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled">PUT</a></td>
<td><b>/apps/<appname></b> - Updates starting app name (requires basic auth, appname, and starting page and returns the port address required for use along with a git repo to push to and running status of the app)<br />
<code>curl -X PUT -u "testuser:123" -d "start=hello1.js" http://api.nodester.com/apps/a</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled">PUT</a></td>
<td><b>/apps/<appname></b> - Start and stop your hosted nodejs app (requires basic auth, appname, and running=true|false and returns the port address required for use along with a git repo to push to)<br />
<code>curl -X PUT -u "testuser:123" -d "running=true" http://api.nodester.com/apps/a</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled danger">DELETE</a></td>
<td><b>/apps/<appname> </b>- Deletes nodejs app (requires basic auth and appname)<br />
<code>curl -X DELETE -u "testuser:123" http://api.nodester.com/apps/<appname></code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled primary">GET</a></td>
<td><b>/apps/<appname></b> - get nodejs app info (requires basic auth and appname)<br />
<code>curl -X GET -u "testuser:123" http://api.nodester.com/apps/<appname></code>
</td>
</tr>
<tr>
<td><b>applogs</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled primary">GET</a></td>
<td><b>/applogs/<appname></b> - Gets nodejs app logs (requires basic auth and appname)<br />
<code>curl -X GET -u "testuser:123" http://api.nodester.com/applogs/<appname></code>
</td>
</tr>
<tr>
<td><b>env</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled">PUT</a></td>
<td><b>/env</b> - Create/update environment key/value pair (requires basic auth, appname, and environment key and value)<br />
<code>curl -X PUT -u "testuser:123" -d "appname=a&key=color&value=blue" http://api.nodester.com/env</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled danger">DELETE</a></td>
<td><b>/env/<appname>/<key></b> - Deletes environment key/value pair (requires basic auth, appname, and environment key)<br />
<code>curl -X DELETE -u "testuser:123" http://api.nodester.com/env/<appname>/<key></code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled primary">GET</a></td>
<td><b>/env</b> - Gets environment info (requires basic auth, appname, and environment key)<br />
<code>curl -X GET -u "testuser:123" http://api.nodester.com/env/<appname></code>
</td>
</tr>
<tr>
<td><b>status</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled primary">GET</a></td>
<td><b>/status</b> - Returns platform status and number of apps hosted and running<br />
<code>curl -X GET http://nodester.com/status</code>
</td>
</tr>
<tr>
<td><b>npm</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled success">POST</a></td>
<td><b>/npm</b> - Allows you to manage the NPM packages for an application.<br />
<code>curl -X POST -u "testuser:123" -d "appname=a&action=install&package=express" http://api.nodester.com/npm</code><br />
<code>curl -X POST -u "testuser:123" -d "appname=a&action=update&package=express" http://api.nodester.com/npm</code><br />
<code>curl -X POST -u "testuser:123" -d "appname=a&action=uninstall&package=express" http://api.nodester.com/npm</code>
</td>
</tr>
<tr>
<td><b>appdomains</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled success">POST</a></td>
<td><b>/appdomains</b> - Creates app domain for hosting example.com (requires basic auth)<br />
<code>curl -X POST -u "testuser:123" -d "appname=test&domain=example.com" http://api.nodester.com/appdomains</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled danger">DELETE</a></td>
<td><b>/appdomains/<appname>/<domain></b> - Deletes app domain for hosting example.com (requires basic auth)<br />
<code>curl -X DELETE -u "testuser:123" http://api.nodester.com/appdomains/<appname>/<domain></code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled primary">GET</a></td>
<td><b>/appdomains</b> - Gets list of your domains (requires basic auth)<br />
<code>curl -X GET -u "testuser:123" http://api.nodester.com/appdomains</code>
</td>
</tr>
<tr>
<td><b>reset_password</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled success">POST</a></td>
<td><b>/reset_password</b> - Sends a e-mail with a token to reset your user password<br />
<code>curl -X POST -d "user=your_username" http://nodester.com/reset_password</code>
</td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled">PUT</a></td>
<td><b>/reset_password/<token></b> - Updates your password using the provided token<br />
<code>curl -X PUT -d "password=your_new_password" http://nodester.com/reset_password/<token></code>
</td>
</tr>
<tr>
<td><b>gitreset</b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a class="btn disabled danger">DELETE</a></td>
<td><b>/gitreset/<appname></b> - Resets your Nodester git repository and npm list (pass in appname)<br />
<code>curl -X DELETE -u "testuser:123" http://api.nodester.com/gitreset/<appname></code>
</td>
</tr>
</table>
</div>
<div class="tab-pane" id="explorer">
<p>Nodester has partnered with Apigee to provide this API Explorer interface for developers to experiment with our RESTful PaaS API. Follow these instructions to get started and have fun!</p>
<p>
1. Click on the padlock (top left) to authenticate using your Nodester credentials <br/>
2. If necessary edit the {sample} parts of the URL with the right information such as your appname<br/>
3. If necessary click on the gear icon (top right) to change params<br/>
4. Click on the orange GET/POST/PUT/DELETE button to run the API request
</p><br />
<div id="videobutton" class="btn danger large">
Watch Video »
</div>
<br />
<script>
$('#videobutton').click(function() {
// window.location.href = 'http://www.youtube.com/watch?v=JnvhOB_DOJo';
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'none',
'title' : this.title,
'width' : 680,
'height' : 495,
'href' : 'http://www.youtube.com/watch?v=JnvhOB_DOJo&hd=1&feature=player_embedded#at=41'.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
});
</script>
<iframe src="https://apigee.com/chris17/embed/console/nodester-api" width="100%" height="600"></iframe>
</div>
</div>
</div>
</div>
</div>
<!-- /container -->
<footer class="footer">
<div class="container">
<p>
© <script type="text/javascript">
var theDate=new Date()
document.write(theDate.getFullYear())
</script> Nodester, inc. | <a href="about.html">about us</a> | <a href="http://twitter.com/nodester">twitter</a> | <a href="http://github.com/nodester">github</a>
</p>
</div>
</footer>
</body>
</html>