Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 153 lines (95 sloc) 4.225 kb
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
1 # JSON API
5f177ba @jfhbrook [fix] anchor tags are now consistent, should fix ronn header issues
jfhbrook authored
2 <a name='api'></a>
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
3
4 Nodejitsu provides a web API for developers who want to interact with the
5 Nodejitsu platform programatically. This API is built to be
6 [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) and
7 communicates via [JSON](http://en.wikipedia.org/wiki/JSON). The API is the most
8 low-level way of interacting with the Nodejitsu platform. For most deployment
9 scenarios you should use our command line tool, [jitsu](#jitsu), or the
10 [online administrative interface](#webapp).
11
bb7b9a8 @jfhbrook Added a note about our api client
jfhbrook authored
12 ## API Clients
13
14 Nodejitsu has a JSON API client for node.js, which may be found [here](https://github.com/nodejitsu/nodejitsu-api) (along with API clients in other languages as they are developed). Jitsu is implemented by using the node.js API client.
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
15
16 ## Authentication
17
bb7b9a8 @jfhbrook Added a note about our api client
jfhbrook authored
18 Most of the calls to the API will require that you authenticate using your Nodejitsu account. If you do not have an account it is possible to create one using the API, the [jitsu CLI](#jitsu), or just by visiting [http://nodejitsu.com](http://nodejitsu.com). Currently, we support [Basic Authentication](http://en.wikipedia.org/wiki/Basic_access_authentication). If you haven't used Basic Auth before, don't fret; it's easy!
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
19
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
20 Here is an example using the command line utility,
21 [Curl](http://curl.haxx.se/):
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
22
23 // get all applications for User "Marak"
dce353a @3rd-Eden [doc] use HTTPS instead of HTTP to access the Nodejitsu API
3rd-Eden authored
24 curl --user Marak:password https://api.nodejitsu.com/apps/marak
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
25
26 ## Applications
27
b9b178d @jfhbrook [fix] Basic updates to reflect the current state of Nodejitsu
jfhbrook authored
28 Applications are the core of the Nodejitsu API. Each application represents a set of Node.js code plus a package.json which contains meta-data about the application such as it's dependencies, database connections, configuration settings and authors. For more information about the package.json format see: [package.json](#package_json)
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
29
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
30 ### Get all Applications for a User
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
31
32 GET /apps/:user-id
33
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
34 ### Create a new Application
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
35
36 POST /apps/:user-id
37 { package.json }
38
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
39 ### Start an Application
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
40
41 POST /apps/:user-id/:app-id/start
42
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
43 ### Stop an Application
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
44
45 POST /apps/:user-id/:app-id/stop
46
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
47 ### Restart an Application
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
48
49 POST /apps/:user-id/:app-id/restart
50
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
51 ### Update an Application
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
52
53 PUT /apps/:user-id
54 { package.json }
55
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
56 ### Delete an Application
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
57
58 DELETE /apps/:user-id/:app-id/remove
59
60 ## Snapshots
61
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
62 ### Make an existing snapshot the active app
550a616 @jfhbrook [fix] Activate a snapshot with the json api
jfhbrook authored
63 POST /apps/:user-id/:app-id/snapshots/:id/activate
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
64
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
65 ### Activate / Deploy a snapshot
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
66 POST /apps/:user-id/:snapshots/:id
67
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
68 ### Show a catalog of all Snapshot for an Application
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
69 GET /apps/:user-id/:app-id/snapshots
70
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
71 ### Show the contents of a Snapshot
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
72 GET /apps/:user-id/:app-id/snapshots/:id
73
74
75 ## Users
76
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
77 ### Create a new User / Sign-up for a free Nodejitsu account
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
78
79 Email address is the only required field.
80
81 POST /users/:user-id
82 {
83 email: "youremail@theinternet.com"
84 }
85
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
86 ### Confirm a User account
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
87
88 All User accounts must be confirmed. When a new User is created, a confirmation email will be sent to the email address associated with that user. In this email there will be an invite code. This code must be sent to the API to confirm the account.
89
90 POST /users/:user-id
91 {
92 inviteCode: "SecretCode"
93 }
94
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
95 ### Update User
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
96
97 PUT /users/:user-id
98 {
99 password: "new_password"
100 }
101
102 ## Databases
103
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
104 ### Create a new Database
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
105
106 POST /databases/:user-id/:database-id
107 {
7dd4983 @jfhbrook [fix] Creating a new database needs lowercase types.
jfhbrook authored
108 type: "couch" || "redis" || "mongo"
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
109 }
110
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
111 ### Get information about a Database
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
112
113 GET /databases/:user-id/:database-id
114
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
115 ### Delete a Database
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
116
117 DELETE /databases/:user-id/:database-id
118
119 ## Logging
120
7dd4983 @jfhbrook [fix] Creating a new database needs lowercase types.
jfhbrook authored
121 Logging is a very important feature in any professional grade Node.js
122 application. Nodejitsu provides integrated logging solutions for your
123 applications. Your logs are always saved and ready to be retrieved.
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
124
125 ### Get all logs for a user
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
126
9db7e4f @jfhbrook [doc] You need to post from/until/rows data to logging requests
jfhbrook authored
127 POST /logs/:user-id/
128 {
129 "from": "NOW-3YEARS",
130 "until": "NOW",
131 "rows": 15
132 }
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
133
dbc1013 @jfhbrook [doc] Cleaned up JSON API chapter somewhat, inlined a few TODO comments.
jfhbrook authored
134 ### Get logs for a specific application
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
135
9db7e4f @jfhbrook [doc] You need to post from/until/rows data to logging requests
jfhbrook authored
136 POST /logs/:user-id/:app-id
137 {
138 "from": "NOW-3YEARS",
139 "until": "NOW",
140 "rows": 15
141 }
a1b5798 @jfhbrook Factored out the "tools" chapter into five separate chapters.
jfhbrook authored
142
143 ## Marketplace
144
145 #### Get all Marketplace Applications
146
147 GET /marketplace
148
149 #### Get a specific Marketplace Application
150
151 GET /databases/:user-id/:id
152
Something went wrong with that request. Please try again.