forked from xcarpentier/developers.scalingo.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
685 lines (544 loc) · 41.2 KB
/
index.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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
---
layout: default
---
<div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'><h1 id="global-information">Global information</h1>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="introduction">Introduction</h2>
<p>The Scalingo V1 API is a publicly available interface allowing developers to
control Scalingo’s entire cloud computing platform and access to the rich
Scalingo dataset. The interface is stable and currently used by the Scalingo
<a href="http://cli.scalingo.com">command line client</a> (written in Go) and
<a href="https://my.scalingo.com">dashboard</a> (an EmberJS app). However, changes are
occasionally made to improve performance and enhance features. See the
changelog for more details.</p>
<p>If you’re an addon provider, you’d better go to <a href="http://developers.scalingo.com/addon-provider-api">our addon provider
API</a> for you to interface
your service with Scalingo’s platform.</p>
<p>The current API version is the <strong>v1</strong>. All the endpoints are prefixed by <code class="highlighter-rouge">/v1</code>.
It’s only available through HTTPS: it’s TLS, or nothing.</p>
<p>The API has been tagged <strong>v1</strong>. However it is not a frozen API. We may and we
will update endpoints and create new ones. But you can be sure we won’t break
the existing. If any major change about the way JSON is structured, we will
keep the right to release a <strong>v2</strong> and so forth.</p>
<p>When any change is applied to the API, it will be displayed in ths <a href="/#changelog">changelog
section</a> of this documentation and on our <a href="http://changelog.scalingo.com">changelog
website</a></p>
<blockquote>
<p>Last update: Wednesday 24th August 2015</p>
</blockquote>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Base URL:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>https://api.scalingo.com/v1/
</code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="http-verbs">HTTP Verbs</h2>
<p>The API is not perfectly RESTful, it is more REST-ish. It has been developed to
be easy to use and instinctive, we’ll probably normalize it, in a second version.</p>
<ul>
<li>HEAD Can be issued against any resource to get just the HTTP header info.</li>
<li>GET Get resources, nullipotent operation (no matter how many times you call it, there is no side effect).</li>
<li>POST Used for creating resources. (creation of a new app, or to create an environment variable)</li>
<li>PATCH Update part of resources, as the value of an environment variable.</li>
<li>PUT Update complete resources.</li>
<li>DELETE Used for deleting items.</li>
</ul>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="parameters">Parameters</h2>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h3 id="get-and-delete-endpoints">GET and DELETE endpoints</h3>
<p>Parameters for GET and DELETE requests are known as <em>query parameters</em>, they are declared in the resource URL.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -X GET https://api.scalingo.com/v1/apps/name/events?page<span class="o">=</span>2
</code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h3 id="postputpatch">POST/PUT/PATCH</h3>
<p>For these types of request, parameters are not included as query parameters,
they should be encoded as JSON with the following header: `Content-Type:
‘application/json’.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s1">'Accept: application/json'</span> -H <span class="s1">'Content-Type: application/json'</span> -u <span class="s2">":</span><span class="nv">$AUTH_TOKEN</span><span class="s2">"</span> <span class="se">\</span>
-X POST https://api.scalingo.com/v1/apps -d <span class="se">\</span>
<span class="s1">'{
"app": {
"name": "example-app"
}
}'</span>
</code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h1 id="authentication">Authentication</h1>
<p>The authentication to the API is done thanks to an authentication token and
Basic HTTP Auth. The API is HTTPS only, so credentials are always sent encrypted.</p>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="get-your-api-token-from-our-dashboard">Get your API token from our dashboard</h2>
<p>You can obtain your API token from your profile from the dashboard:</p>
<p><a href="https://my.scalingo.com/apps/profile">Get your API Token</a></p>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="get-your-api-token-from-the-api">Get your API token from the API</h2>
<p>Otherwise your can get your API token from the API directly:</p>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p><code class="highlighter-rouge">POST https://api.scalingo.com/v1/users/sign_in</code></p>
<p>Parameters:</p>
<ul>
<li><code class="highlighter-rouge">user.login</code>: Email of your account</li>
<li><code class="highlighter-rouge">user.password</code>: Password or your account</li>
</ul>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span>
-X POST https://api.scalingo.com/v1/users/sign_in -d <span class="se">\</span>
<span class="s1">'{
"user": {
"login": "[email protected]",
"password": "example-secret"
}
}'</span>
</code></pre>
</div>
<p>Returns 201 Created</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"authentication_token"</span><span class="p">:</span><span class="s2">"abcdef0123456789-"</span><span class="p">,</span><span class="w">
</span><span class="s2">"user"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="s2">"51dba73fedfe42612000002"</span><span class="p">,</span><span class="w">
</span><span class="s2">"email"</span><span class="p">:</span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
</span><span class="s2">"username"</span><span class="p">:</span><span class="s2">"leo"</span><span class="p">,</span><span class="w">
</span><span class="s2">"first_name"</span><span class="p">:</span><span class="s2">"Léo"</span><span class="p">,</span><span class="w">
</span><span class="s2">"last_name"</span><span class="p">:</span><span class="s2">"Unbekandt"</span><span class="p">,</span><span class="w">
</span><span class="s2">"company"</span><span class="p">:</span><span class="s2">"Scalingo"</span><span class="p">,</span><span class="w">
</span><span class="s2">"location"</span><span class="p">:</span><span class="s2">"Strasbourg France"</span><span class="p">,</span><span class="w">
</span><span class="s2">"email_newsletter"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="s2">"email_personal_advice"</span><span class="p">:</span><span class="kc">true</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="make-an-authenticated-request">Make an authenticated request</h2>
<p>HTTP requests have to be authenticated with HTTP basic auth, with the
authentication token as password, the username can be empty.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> -u <span class="s2">":</span><span class="nv">$AUTH_TOKEN</span><span class="s2">"</span> <span class="se">\</span>
-X GET https://api.scalingo.com/v1/apps
</code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h1 id="data-format">Data format</h1>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="json">JSON</h2>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p>The API sends and receives JSON, XML is not accepted, please ensure JSON is used. All the
returned object are <code class="highlighter-rouge">object</code>, there is never an <code class="highlighter-rouge">array</code> as root element.</p>
<p>Resources are rooted, it means that they have a parent key corresponding to its name. This
key may be plural if a collection of items is returned.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span>
<span class="s2">"app"</span><span class="err">:</span> <span class="p">{</span>
<span class="c1">// application</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
</div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span>
<span class="s2">"apps"</span><span class="err">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="c1">// application</span>
<span class="p">},</span> <span class="p">{</span>
<span class="c1">// application</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
</code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="dates">Dates</h2>
<p>All the dates are sent with the ISO 8601: YYYY-MM-DDThh:mm:ss.μμμZ</p>
<p>Example:</p>
<p><strong>2015-01-13T09:20:31.123+01:00</strong></p>
<p>This format is commonly understood, here are some examples:</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Javascript:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="kd">var</span> <span class="nx">date</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="s2">"2015-01-13T09:20:31.123+01:00"</span><span class="p">)</span>
<span class="nx">Tue</span> <span class="nx">Jan</span> <span class="mi">13</span> <span class="mi">2015</span> <span class="mi">09</span><span class="err">:</span><span class="mi">20</span><span class="err">:</span><span class="mi">31</span> <span class="nx">GMT</span><span class="o">+</span><span class="mi">0100</span> <span class="p">(</span><span class="nx">CET</span><span class="p">)</span>
</code></pre>
</div>
<p>Ruby:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="nb">require</span> <span class="s1">'date'</span>
<span class="no">DateTime</span><span class="p">.</span><span class="nf">iso8601</span><span class="p">(</span><span class="s2">"2015-01-13T09:20:31.123+01:00"</span><span class="p">)</span>
<span class="o">=></span> <span class="c1">#<DateTime: 2015-01-13T09:20:31+01:00 ((2457036j,30031s,123000000n),+3600s,2299161j)></span>
</code></pre>
</div>
<p>Go:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="c">/*
* go run iso8601.go
* 2015-01-13 09:20:31.123 +0100 CET
*/</span><span class="x">
</span><span class="n">date</span><span class="p">,</span><span class="x"> </span><span class="n">_</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">time</span><span class="o">.</span><span class="n">Parse</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">RFC3339Nano</span><span class="p">,</span><span class="x"> </span><span class="s">"2015-01-13T09:20:31.123+01:00"</span><span class="p">)</span><span class="x">
</span><span class="n">fmt</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="n">date</span><span class="p">)</span><span class="x">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h1 id="errors">Errors</h1>
<h2 id="client-errors---status-codes-4xx">Client errors - Status codes: 4xx</h2>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h3 id="invalid-json---400-bad-request">Invalid JSON - 400 Bad Request</h3>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p>The JSON you’ve sent in the payload is is wrongly formatted.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s1">'Content-Type: application/json'</span> -H <span class="s1">'Accept: application/json'</span> -u <span class="s2">":</span><span class="nv">$AUTH_TOKEN</span><span class="s2">"</span> <span class="se">\</span>
-X POST https://api.scalingo.com/v1/users/sign_in -d <span class="s1">'{"user": {'</span>
</code></pre>
</div>
<p>Returns HTTP/1.1 400 Bad Request</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"error"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"There was a problem in the JSON you submitted: 795: unexpected token at '{\"user\": {'"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h3 id="exceeding-free-trial---402-payment-required">Exceeding free trial - 402 Payment Required</h3>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p>If you try to do an action unallowed in the free trial, you will get an error 402 Payment Required.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s1">'Content-Type: application/json'</span> -H <span class="s1">'Accept: application/json'</span> -u <span class="s2">":</span><span class="nv">$AUTH_TOKEN</span><span class="s2">"</span> <span class="se">\</span>
-X POST https://api.scalingo.com/v1/apps -d <span class="se">\</span>
<span class="s1">'{
"app" : {
"name" : "my-new-app"
}
}'</span>
</code></pre>
</div>
<p>Returns 402 Payment Required if user is not allowed to create a new app.</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"error"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Sorry, you need to verify your account (billing profile and payment card) to create a new app"</span><span class="p">,</span><span class="w">
</span><span class="s2">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://my.scalingo.com/apps/billing"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h3 id="resource-not-found---404-not-found">Resource not found - 404 Not found</h3>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p>When you’re doing a request to an invalid resource</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s1">'Content-Type: application/json'</span> -H <span class="s1">'Accept: application/json'</span> -u <span class="s2">":</span><span class="nv">$AUTH_TOKEN</span><span class="s2">"</span> <span class="se">\</span>
-X GET https://api.scalingo.com/v1/apps/123
</code></pre>
</div>
<p>Returns HTTP/1.1 404 Not Found</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"resource"</span><span class="p">:</span><span class="w"> </span><span class="s2">"app"</span><span class="p">,</span><span class="w">
</span><span class="s2">"error"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"not found"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h3 id="invalid-field---422-unprocessable-entity">Invalid field - 422 Unprocessable Entity</h3>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p>There is an invalid field in the JSON payload.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s1">'Content-Type: application/json'</span> -H <span class="s1">'Accept: application/json'</span> -u <span class="s2">":</span><span class="nv">$AUTH_TOKEN</span><span class="s2">"</span> <span class="se">\</span>
-X POST https://api.scalingo.com/v1/apps -d <span class="s1">'{}'</span>
</code></pre>
</div>
<p>Returns HTTP/1.1 422 Unprocessable Entity</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"errors"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"app"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="s2">"missing field"</span><span class="w"> </span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h3 id="invalid-data---422-unprocessable-entity">Invalid data - 422 Unprocessable Entity</h3>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p>Invalid data were sent in the payload.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s1">'Content-Type: application/json'</span> -H <span class="s1">'Accept: application/json'</span> -u <span class="s2">":</span><span class="nv">$AUTH_TOKEN</span><span class="s2">"</span> <span class="se">\</span>
-X POST https://api.scalingo.com/v1/apps -d <span class="se">\</span>
<span class="s1">'{
"app" : {
"name" : "AnotherApp"
}
}'</span>
</code></pre>
</div>
<p>Returns HTTP/1.1 422 Unprocessable Entity</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"errors"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"name"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="s2">"should contain only lowercap letters, digits and hyphens"</span><span class="w"> </span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h3 id="server-errors---50x">Server errors - 50x</h3>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p>If the server returns a 50x status code, something wrong happened on our side.
You can’t do anything about it, you can be sure that our team got notifications
for it and that it will be fixed really quickly.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example of error 500:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"error"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Internal error occured, we're on it!"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h1 id="pagination">Pagination</h1>
<p>Some resources provided by the platform API are paginated. To
ensure you can correctly handle it, metadata are added to the JSON of the
response.</p>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="request-parameters">Request parameters</h2>
<ul>
<li><code class="highlighter-rouge">page</code>: Requested page number</li>
<li><code class="highlighter-rouge">per_page</code>: Number of entries per page.
Each resource has a maximum for this value to avoid oversized requests</li>
</ul>
<h2 id="response-meta-values">Response meta values</h2>
<p>The returned JSON object will include a <code class="highlighter-rouge">meta</code> key including pagination
metadata:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"meta"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"pagination"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"prev_page"</span><span class="p">:</span><span class="w"> </span><span class="s2">"<previous page number>"</span><span class="p">,</span><span class="w">
</span><span class="s2">"current_page"</span><span class="p">:</span><span class="w"> </span><span class="s2">"<requested page number>"</span><span class="p">,</span><span class="w">
</span><span class="s2">"next_page"</span><span class="p">:</span><span class="w"> </span><span class="s2">"<next page number>"</span><span class="p">,</span><span class="w">
</span><span class="s2">"total_pages"</span><span class="p">:</span><span class="w"> </span><span class="s2">"<total amount of pages>"</span><span class="p">,</span><span class="w">
</span><span class="s2">"total_count"</span><span class="p">:</span><span class="w"> </span><span class="s2">"<total amount of items in the collection>"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<blockquote>
<p><code class="highlighter-rouge">prev_page</code> and/or <code class="highlighter-rouge">next_page</code> are equal to <code class="highlighter-rouge">null</code> if there is no previous
or next page.</p>
</blockquote>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> -u :<span class="nv">$AUTH_TOKEN</span> <span class="se">\</span>
-X GET <span class="s1">'https://api.scalingo.com/v1/apps/example-app/events?page=4&per_page=20'</span>
</code></pre>
</div>
<p>Returns 200 OK</p>
<p>This request returns the events 40 to 60.</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"events"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w"> </span><span class="err">...</span><span class="w"> </span><span class="err">}</span><span class="w">
</span><span class="p">],</span><span class="w">
</span><span class="s2">"meta"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"current_page"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
</span><span class="s2">"prev_page"</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w">
</span><span class="s2">"next_page"</span><span class="p">:</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w">
</span><span class="s2">"total_pages"</span><span class="p">:</span><span class="w"> </span><span class="mi">12</span><span class="p">,</span><span class="w">
</span><span class="s2">"total_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">240</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h1 id="changelog">Changelog</h1>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="wednesday-12th-august-2015">Wednesday 12th August 2015:</h2>
<p>Add multiple event to the app timeline</p>
<ul>
<li><code class="highlighter-rouge">new_collaborator</code></li>
<li><code class="highlighter-rouge">accept_collaborator</code></li>
<li><code class="highlighter-rouge">delete_collaborator</code></li>
<li><code class="highlighter-rouge">new_domain</code></li>
<li><code class="highlighter-rouge">edit_domain</code></li>
<li><code class="highlighter-rouge">delete_domain</code></li>
<li><code class="highlighter-rouge">new_addon</code></li>
<li><code class="highlighter-rouge">upgrade_addon</code></li>
<li><code class="highlighter-rouge">delete_addon</code></li>
<li><code class="highlighter-rouge">new_app</code></li>
<li><code class="highlighter-rouge">rename_app</code></li>
<li><code class="highlighter-rouge">transfer_app</code></li>
</ul>
<h2 id="tuesday-11th-august-2015">Tuesday 11th August 2015:</h2>
<p>Update data format of specialized data in event.</p>
<p>Add <code class="highlighter-rouge">type_data</code> attribute in all events.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example change: scale event</p>
<p>Old format:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"54dcdd4a73636100011a0000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"created_at"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"2015-02-12T18:05:14.226+01:00"</span><span class="p">,</span><span class="w">
</span><span class="s2">"user"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"username"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"johndoe"</span><span class="p">,</span><span class="w">
</span><span class="s2">"email"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
</span><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"51e6bc626edfe40bbb000001"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="s2">"app_id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"5343eccd646173000a140000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"type"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"scale"</span><span class="p">,</span><span class="w">
</span><span class="s2">"previous_containers"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"web"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
</span><span class="s2">"worker"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="s2">"containers"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"web"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="s2">"worker"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<p>New format:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"54dcdd4a73636100011a0000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"created_at"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"2015-02-12T18:05:14.226+01:00"</span><span class="p">,</span><span class="w">
</span><span class="s2">"user"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"username"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"johndoe"</span><span class="p">,</span><span class="w">
</span><span class="s2">"email"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"[email protected]"</span><span class="p">,</span><span class="w">
</span><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"51e6bc626edfe40bbb000001"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="s2">"app_id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"5343eccd646173000a140000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"type"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"scale"</span><span class="p">,</span><span class="w">
</span><span class="s2">"type_data"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"previous_containers"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"web"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
</span><span class="s2">"worker"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="s2">"containers"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"web"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="s2">"worker"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="monday-10th-august-2015">Monday 10th August 2015:</h2>
<p>Bulk upgrade of application environment</p>
<p>New endpoint: PUT <code class="highlighter-rouge">/apps/[:app_id]/variables</code></p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span>
-X PUT -u :<span class="nv">$AUTH_TOKEN</span> https://api.scalingo.com/v1/apps/example-app/variables -d <span class="se">\</span>
<span class="s1">'{
"variables": [{
"name":"RAILS_ENV",
"value":"production"
},{
"name":"RACK_ENV",
"value":"production"
}]
}'</span>
</code></pre>
</div>
<p>Returns 200 OK</p>
<p>Response</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"variables"</span><span class="p">:</span><span class="w"> </span><span class="p">[{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"541013a9736f7563d5050000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"name"</span><span class="p">:</span><span class="s2">"RAILS_ENV"</span><span class="p">,</span><span class="w">
</span><span class="s2">"value"</span><span class="p">:</span><span class="s2">"production"</span><span class="w">
</span><span class="p">},{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"541013a9736f7563d5050001"</span><span class="p">,</span><span class="w">
</span><span class="s2">"name"</span><span class="p">:</span><span class="s2">"RACK_ENV"</span><span class="p">,</span><span class="w">
</span><span class="s2">"value"</span><span class="p">:</span><span class="s2">"production"</span><span class="w">
</span><span class="p">}]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="thursday-9th-july-2015">Thursday 9th July 2015:</h2>
<p>Add <code class="highlighter-rouge">addon_provider.logo_url</code> to addon</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span>
<span class="s2">"addon"</span><span class="err">:</span> <span class="p">{</span>
<span class="c1">// ...</span>
<span class="s2">"addon_provider"</span><span class="err">:</span> <span class="p">{</span>
<span class="s2">"id"</span><span class="err">:</span> <span class="s2">"scalingo-redis"</span><span class="p">,</span>
<span class="s2">"name"</span><span class="err">:</span> <span class="s2">"Scalingo Redis"</span><span class="p">,</span>
<span class="s2">"logo_url"</span><span class="err">:</span> <span class="s2">"//storage.sbg1.cloud.ovh.net/v1/AUTH_be65d32d71a6435589a419eac98613f2/scalingo/redis.png"</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
</div>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="wednesday-13rd-may-2015">Wednesday 13rd May 2015:</h2>
<p>Additional <code class="highlighter-rouge">links</code> attribute in deployments</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span>
<span class="c1">// ...</span>
<span class="s2">"links"</span><span class="err">:</span> <span class="p">{</span>
<span class="s2">"output"</span><span class="err">:</span> <span class="s2">"https://api.scalingo.com/v1/apps/example-app/deployments/123e4567-e89b-12d3-a456-426655440000/output"</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
</div>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="wednesday-15th-april-2015">Wednesday 15th April 2015:</h2>
<p>Additional <code class="highlighter-rouge">size</code> field in <code class="highlighter-rouge">/apps/:app/scale</code> for vertical scaling</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> -u :<span class="nv">$AUTH_TOKEN</span> <span class="se">\</span>
-X POST <span class="s1">'https://api.scalingo.com/v1/apps/example-app/scale'</span> -d <span class="se">\</span>
<span class="s1">'{
"containers": [
{
"name": "web",
"amount": 2,
"size": "L"
}
]
}'</span>
</code></pre>
</div>
<p>Returns 202 Accepted (Asynchronous task)
Headers:
* <code class="highlighter-rouge">Location</code>: ‘https://api.scalingo.com/v1/apps/example-app/operations/52fd2357356330032b080000’</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"containers"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"52fd2457356330032b020000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"web"</span><span class="p">,</span><span class="w">
</span><span class="s2">"amount"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="s2">"size"</span><span class="p">:</span><span class="w"> </span><span class="s2">"L"</span><span class="w">
</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"52fd235735633003210a0001"</span><span class="p">,</span><span class="w">
</span><span class="s2">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"worker"</span><span class="p">,</span><span class="w">
</span><span class="s2">"amount"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
</span><span class="s2">"size"</span><span class="p">:</span><span class="w"> </span><span class="s2">"M"</span><span class="p">,</span><span class="w">
</span><span class="err">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="sunday-1st-march-2015">Sunday 1st March 2015:</h2>
<p>The 404 not found error got a new field <code class="highlighter-rouge">resource</code> to define the resource
which has not been found.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s1">'Content-Type: application/json'</span> -H <span class="s1">'Accept: application/json'</span> -u <span class="s2">":</span><span class="nv">$AUTH</span><span class="s2">"</span> <span class="se">\</span>
-X POST https://api.scalingo.com/v1/users/sign_in -d <span class="se">\</span>
<span class="s1">'{
"user": {
"login": "test-user",
"password": "super-secret"
}
}'</span>
</code></pre>
</div>
<p>Response 404 Not found</p>
<p>Before:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"authentication_token"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0123456789abcdef"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<p>After:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span>
<span class="s2">"authentication_token"</span><span class="err">:</span> <span class="s2">"0123456789abcdef"</span><span class="p">,</span>
<span class="s2">"user"</span><span class="err">:</span> <span class="p">{</span>
<span class="c1">// user model</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
</div>
</div></div>