-
Notifications
You must be signed in to change notification settings - Fork 6
/
domains.html
272 lines (224 loc) · 15.8 KB
/
domains.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
---
layout: default
title: Domains
---
<div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'><h1 id="domains">Domains</h1>
<p>The domains represent the custom domain names defined for your applications.
For instance, the alias <code class="highlighter-rouge">www.example.com</code> of <code class="highlighter-rouge">example-app.scalingo.io</code> will
result in the presence of one resource domain.</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><strong>Keys attributes</strong></p>
<table class="table">
<thead>
<tr>
<th>field</th>
<th>type</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>unique ID of the domain</td>
</tr>
<tr>
<td>name</td>
<td>hostname your want to associate with the app</td>
</tr>
<tr>
<td>tlscert (read)</td>
<td>subject of the submitted certificate</td>
</tr>
<tr>
<td>tlscert (write)</td>
<td>content of the SSL certificate you want to use</td>
</tr>
<tr>
<td>tlskey (read)</td>
<td>private key type and length</td>
</tr>
<tr>
<td>tlskey (write)</td>
<td>content of the private key used to generate the certificate</td>
</tr>
<tr>
<td>ssl (read-only)</td>
<td>flag if SSL with a custom certificate is enabled</td>
</tr>
<tr>
<td>validity (read-only)</td>
<td>once a certificate has been submitted, display the validity of it</td>
</tr>
</tbody>
</table>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example object</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">"541067ec736f7504a5110000"</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">"example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"ssl"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="s2">"tlscert"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/C=FR/ST=Some-State/O=Internet Widgits Pty Ltd/CN=example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"tlskey"</span><span class="p">:</span><span class="w"> </span><span class="s2">"RSA private key - 2048 bytes"</span><span class="p">,</span><span class="w">
</span><span class="s2">"validity"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2015-08-05T19:57:21.000+02:00"</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="list-all-the-domains-of-an-application">List all the domains of an application</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><code class="highlighter-rouge">GET https://api.scalingo.com/v1/apps/[:app]/domains</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> -u :<span class="nv">$AUTH_TOKEN</span> <span class="se">\ </span>
-X GET https://api.scalingo.com/v1/apps/example-app/domains
</code></pre>
</div>
<p>Returns 200 OK</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"domains"</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">"541067f7736f7504a5140000"</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">"example2.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"ssl"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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">"541067ec736f7504a5110000"</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">"example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"ssl"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="s2">"tlscert"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/C=FR/ST=Some-State/O=Internet Widgits Pty Ltd/CN=example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"tlskey"</span><span class="p">:</span><span class="w"> </span><span class="s2">"RSA private key - 2048 bytes"</span><span class="p">,</span><span class="w">
</span><span class="s2">"validity"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2015-08-05T19:57:21.000+02:00"</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="show-a-specific-domain-of-an-application">Show a specific domain of an application</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><code class="highlighter-rouge">GET https://api.scalingo.com/v1/apps/[:app]/domains/[:domain_id]</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> -u :<span class="nv">$AUTH_TOKEN</span> <span class="se">\</span>
-X GET https://api.scalingo.com/v1/apps/example-app/domains/541067ec736f7504a5110000
</code></pre>
</div>
<p>Returns 200 OK</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"domain"</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">"541067ec736f7504a5110000"</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">"example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"ssl"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="unlink-a-domain-name-from-an-application">Unlink a domain name from an application</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><code class="highlighter-rouge">DELETE https://api.scalingo.com/v1/apps/[:app]/domains/[:domain_id]</code></p>
<p>Disassociate instantly a domain name with an app. If the domain is still
<a href="http://doc.scalingo.com/app/domain">CNAME-ed</a>, it will respond with a 404 error.</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 DELETE https://api.scalingo.com/v1/apps/example-app/domains/541067ec736f7504a5110000
</code></pre>
</div>
<p>Returns 204 No Content</p>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="link-a-domain-name-to-an-application">Link a domain name to an application</h2>
<p><code class="highlighter-rouge">POST https://api.scalingo.com/v1/apps/[:app]/domains</code></p>
<h3 id="parameters">Parameters</h3>
<ul>
<li><code class="highlighter-rouge">domain.name</code>: Hostname you want to add</li>
<li><code class="highlighter-rouge">domain.tlscert</code> - optional: SSL Certificate you want to associate with the domain</li>
<li><code class="highlighter-rouge">domain.tlskey</code> - optional: Private key used to create the SSL certificate</li>
</ul>
<p>If the certificate or the key is not valid, a 422 “unprocessable entity” is returned
Otherwise return 201</p>
<h3 id="limit">Limit</h3>
<p>There is a hard limit of 5 custom domains per application, if you need more:
<a href="mailto:support@scalingo.com">contact us</a></p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Request example (without SSL):</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 https://api.scalingo.com/v1/apps/example-app/domains -d <span class="se">\</span>
<span class="s1">'{
"domain" : {
"name" : "example.com"
}
}'</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">"domain"</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">"541067ec736f7504a5110000"</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">"example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"ssl"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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>Request example (with SSL):</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 https://api.scalingo.com/v1/apps/example-app/domains -d <span class="se">\</span>
<span class="s1">'{
"domain" : {
"name" : "example.com",
"tlscert" : "<cert>",
"tlskey" : "<key>"
}
}'</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">"domain"</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">"541067ec736f7504a5110000"</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">"example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"ssl"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="s2">"tlscert"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/C=FR/ST=Some-State/O=Internet Widgits Pty Ltd/CN=example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"tlskey"</span><span class="p">:</span><span class="w"> </span><span class="s2">"RSA private key - 2048 bytes"</span><span class="p">,</span><span class="w">
</span><span class="s2">"validity"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2015-08-05T19:57:21.000+02:00"</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="update-a-domain-name">Update a domain name</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><code class="highlighter-rouge">PATCH https://api.scalingo.com/v1/apps/[:app]/domains/[:domain_id]</code></p>
<p>Parameters</p>
<ul>
<li><code class="highlighter-rouge">domain.tlscert</code> - optional: SSL Certificate you want to associate with the domain</li>
<li><code class="highlighter-rouge">domain.tlskey</code> - optional: Private key used to create the SSL certificate</li>
</ul>
<p>As you may have noticed you can’t update the name itself, instead of modifying it juste
create another Domain and delete the one you wanted to modify.</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 PATCH https://api.scalingo.com/v1/apps/example-app/domains/541067ec736f7504a5110000 -d <span class="se">\</span>
<span class="s1">'{
"domain" : {
"tlscert" : "<cert>",
"tlskey" : "<key>"
}
}'</span>
</code></pre>
</div>
<p>Returns 200 OK</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"domain"</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">"541067ec736f7504a5110000"</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">"example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"ssl"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="s2">"tlscert"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/C=FR/ST=Some-State/O=Internet Widgits Pty Ltd/CN=example.com"</span><span class="p">,</span><span class="w">
</span><span class="s2">"tlskey"</span><span class="p">:</span><span class="w"> </span><span class="s2">"RSA private key - 2048 bytes"</span><span class="p">,</span><span class="w">
</span><span class="s2">"validity"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2015-08-05T19:57:21.000+02:00"</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>