7
7
< meta charset ="utf-8 ">
8
8
< meta content ="IE=edge,chrome=1 " http-equiv ="X-UA-Compatible ">
9
9
< meta name ="viewport " content ="width=device-width, initial-scale=1, maximum-scale=1 ">
10
- < title > Swagger Petstore v1.0.0 </ title >
10
+ < title > Postgres Admin API </ title >
11
11
12
12
< style >
13
13
</ style >
44
44
<!-- Generator: Widdershins v4.0.1 -->
45
45
</ head >
46
46
47
- < body data-languages ="["shell ","http","javascript "] ">
47
+ < body data-languages ="["sh ","js "] ">
48
48
< a href ="# " id ="nav-button ">
49
49
< span >
50
50
NAV
57
57
< div class ="lang-selector ">
58
58
59
59
60
- < a href ="# " data-language-name ="shell "> Shell</ a >
60
+ < a href ="# " data-language-name ="sh "> Shell</ a >
61
61
62
62
63
63
64
- < a href ="# " data-language-name ="http "> HTTP</ a >
65
-
66
-
67
-
68
- < a href ="# " data-language-name ="javascript "> JavaScript</ a >
64
+ < a href ="# " data-language-name ="js "> JavaScript</ a >
69
65
70
66
71
67
</ div >
80
76
< ul class ="toc-list-h1 ">
81
77
82
78
< li >
83
- < a href ="#swagger-pg-api " class ="toc-h1 toc-link " data-title ="@supabase/pg-api " > @supabase/pg-api </ a >
79
+ < a href ="#about " class ="toc-h1 toc-link " data-title ="Postgres API " > Postgres API </ a >
84
80
85
81
</ li >
86
82
90
86
< ul class ="toc-list-h2 ">
91
87
92
88
< li >
93
- < a href ="#installation " class ="toc-h2 toc-link " data-title =""> Installation</ a >
89
+ < a href ="#usage " class ="toc-h2 toc-link " data-title =""> Usage</ a >
90
+
91
+ </ li >
92
+
93
+ < li >
94
+ < a href ="#self-hosting " class ="toc-h2 toc-link " data-title =""> Self Hosting</ a >
94
95
95
96
</ li >
96
97
118
119
</ li >
119
120
120
121
< li >
121
- < a href ="#swagger-pg-api-config " class ="toc-h1 toc-link " data-title ="Config "> Config</ a >
122
+ < a href ="#pg-api-tables " class ="toc-h1 toc-link " data-title ="Tables "> Tables</ a >
123
+
124
+ < ul class ="toc-list-h2 ">
125
+
126
+ < li >
127
+ < a href ="#gettables " class ="toc-h2 toc-link " data-title =""> getTables</ a >
128
+
129
+ </ li >
130
+
131
+ </ ul >
132
+
133
+ </ li >
134
+
135
+ < li >
136
+ < a href ="#pg-api-plugins " class ="toc-h1 toc-link " data-title ="Plugins "> Plugins</ a >
137
+
138
+ < ul class ="toc-list-h2 ">
139
+
140
+ < li >
141
+ < a href ="#getplugins " class ="toc-h2 toc-link " data-title =""> getPlugins</ a >
142
+
143
+ </ li >
144
+
145
+ </ ul >
146
+
147
+ </ li >
148
+
149
+ < li >
150
+ < a href ="#pg-api-config " class ="toc-h1 toc-link " data-title ="Config "> Config</ a >
122
151
123
152
< ul class ="toc-list-h2 ">
124
153
141
170
142
171
< ul class ="toc-footer ">
143
172
144
- < li > < a href ="https://mermade.github.io/shins/asyncapi.html " > See AsyncAPI example </ a > </ li >
173
+ < li > © < a href ="https://supabase.io " > Supabase </ a > 2020 </ li >
145
174
146
175
</ ul >
147
176
148
177
</ div >
149
178
< div class ="page-wrapper ">
150
179
< div class ="dark-box "> </ div >
151
180
< div class ="content ">
152
- < h1 id ="swagger-pg-api " > @supabase/pg-api </ h1 >
181
+ < h1 id ="about " > Postgres API </ h1 >
153
182
< blockquote >
154
183
< p > Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.</ p >
155
184
</ blockquote >
156
185
< p > Manage your PostgreSQL database using a RESTful API.</ p >
186
+ < p > This is still in early development, so most of the functionality is read-only. The goal of this API is to allow any user to manage a Postgres database using a RESTful interface. This includes running queries as well as adding tables, columns, roles, and users at runtime.</ p >
187
+ < h3 id ="support "> Support</ h3 >
188
+ < ul >
189
+ < li > Repository: < a href ="https://github.com/supabase/pg-api "> https://github.com/supabase/pg-api</ a > </ li >
190
+ < li > Made by Supabase: < a href ="https://supabase.io "> https://supabase.io</ a > </ li >
191
+ </ ul >
157
192
< h1 id ="getting-started "> Getting started</ h1 >
158
- < h2 id ="installation "> Installation</ h2 >
159
- < pre class ="highlight "> < code > @todo
193
+ < h2 id ="usage "> Usage</ h2 >
194
+ < blockquote >
195
+ < p > Basic usage</ p >
196
+ </ blockquote >
197
+ < pre class ="highlight tab tab-sh "> < code > curl -X GET https://pg-api.fly.dev/ \
198
+ -H < span class ="hljs-string "> 'Content-Type: application/json'</ span > \
199
+ -H < span class ="hljs-string "> 'pg: {}'</ span > < span class ="hljs-comment "> # see Postgres connection header below</ span >
160
200
</ code > </ pre >
201
+ < pre class ="highlight tab tab-js "> < code > < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'https://pg-api.fly.dev'</ span > , {
202
+ < span class ="hljs-attr "> method</ span > : < span class ="hljs-string "> 'GET'</ span > ,
203
+ < span class ="hljs-attr "> headers</ span > : {
204
+ < span class ="hljs-string "> 'Content-Type'</ span > : < span class ="hljs-string "> 'application/json'</ span > ,
205
+ < span class ="hljs-string "> 'pg'</ span > : {} < span class ="hljs-comment "> // see Postgres connection header below</ span >
206
+ }
207
+ })
208
+ </ code > </ pre >
209
+ < blockquote >
210
+ < p > Postgres connection header</ p >
211
+ </ blockquote >
212
+ < pre class ="highlight tab tab-json "> < code > {
213
+ < span class ="hljs-attr "> "user"</ span > : < span class ="hljs-string "> "postgres"</ span > ,
214
+ < span class ="hljs-attr "> "password"</ span > : < span class ="hljs-string "> "postgres"</ span > ,
215
+ < span class ="hljs-attr "> "port"</ span > : < span class ="hljs-number "> 5432</ span > ,
216
+ < span class ="hljs-attr "> "host"</ span > : < span class ="hljs-string "> "db.domain.com"</ span >
217
+ }
218
+ </ code > </ pre >
219
+ < p > For security reasons, this API is best self-hosted. However, we provide an example API for you to test before installing. To use the API however, you have to send your PG connection via HTTPS headers.</ p >
220
+ < p > We DO NOT log these headers anywhere. But still, we HIGHLY recommend that you just self-host (we have tried to make this easy for you). Use the demo API at your own risk.</ p >
221
+ < p > Database connection headers are not required for self-hosting. You can set ENV vars with your default connection details so that you don't pass connection details over a network.</ p >
222
+ < h2 id ="self-hosting "> Self Hosting</ h2 >
223
+ < pre class ="highlight "> < code > https://github.com/supabase/pg-api
224
+ </ code > </ pre >
225
+ < p > We support several different methods for self-hosting, detailed in the < a href ="https://github.com/supabase/pg-api "> repository</ a > .</ p >
161
226
< h2 id ="authentication "> Authentication</ h2 >
162
227
< p > Authentication is not provided. Make sure you use this inside a secure network or put your own API proxy in front.</ p >
163
228
< h1 id ="swagger-pg-api-query "> Query</ h1 >
@@ -167,30 +232,26 @@ <h2 id="query">query</h2>
167
232
< blockquote >
168
233
< p > POST /query</ p >
169
234
</ blockquote >
170
- < pre class ="highlight tab tab-shell "> < code > curl -X POST http ://localhost:1337 /query \
235
+ < pre class ="highlight tab tab-sh "> < code > curl -X POST https ://pg-api.fly.dev /query \
171
236
-H < span class ="hljs-string "> 'Content-Type: application/json'</ span > \
237
+ -d < span class ="hljs-string "> '{}'</ span > < span class ="hljs-comment "> # see example body below</ span >
172
238
</ code > </ pre >
173
- < pre class ="highlight tab tab-http "> < code > < span class ="hljs-keyword "> POST</ span > < span class ="hljs-string "> http://localhost:1337/pet</ span > HTTP/1.1
174
- < span class ="hljs-attribute "> Host</ span > : localhost:1337
175
- < span class ="hljs-attribute "> Content-Type</ span > : application/json
176
-
177
- </ code > </ pre >
178
- < pre class ="highlight tab tab-javascript "> < code >
179
- < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'http://localhost:1337/query'</ span > , {
239
+ < pre class ="highlight tab tab-js "> < code >
240
+ < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'https://pg-api.fly.dev/query'</ span > , {
180
241
< span class ="hljs-attr "> method</ span > : < span class ="hljs-string "> 'POST'</ span > ,
181
242
< span class ="hljs-attr "> headers</ span > : { < span class ="hljs-string "> 'Content-Type'</ span > : < span class ="hljs-string "> 'application/json'</ span > },
182
- body < span class ="hljs-comment "> // See body below</ span >
243
+ < span class =" hljs-attr " > body</ span > : {} < span class ="hljs-comment "> // see example body below</ span >
183
244
})
184
245
</ code > </ pre >
185
- < p > < code > POST /query</ code > </ p >
186
- < p > < em > Execute an SQL query</ em > </ p >
187
246
< blockquote >
188
- < p > BODY </ p >
247
+ < p > Example body </ p >
189
248
</ blockquote >
190
249
< pre class ="highlight tab tab-json "> < code > {
191
250
< span class ="hljs-attr "> "query"</ span > : < span class ="hljs-string "> "SELECT * FROM your_table LIMIT 1;"</ span >
192
251
}
193
252
</ code > </ pre >
253
+ < p > < code > POST /query</ code > </ p >
254
+ < p > < em > Execute an SQL query</ em > </ p >
194
255
< h3 id ="addpet-parameters "> Parameters</ h3 >
195
256
< table >
196
257
< thead >
@@ -210,33 +271,81 @@ <h3 id="addpet-parameters">Parameters</h3>
210
271
</ tr >
211
272
</ tbody >
212
273
</ table >
213
- < h1 id ="swagger-pg-api-config "> Config</ h1 >
214
- < p > Manage your Postgres config</ p >
274
+ < h1 id ="pg-api-tables "> Tables</ h1 >
275
+ < p > View and manage your Postgres tables.</ p >
276
+ < h2 id ="gettables "> getTables</ h2 >
277
+ < p > < a id ="get-tables "> </ a > </ p >
278
+ < blockquote >
279
+ < p > GET /tables</ p >
280
+ </ blockquote >
281
+ < pre class ="highlight tab tab-sh "> < code > curl -X GET https://pg-api.fly.dev/tables \
282
+ -H < span class ="hljs-string "> 'Content-Type: application/json'</ span > \
283
+ -H < span class ="hljs-string "> 'pg: { "host": "DB_HOST", "password": "DB_PASSWORD" }'</ span >
284
+ </ code > </ pre >
285
+ < pre class ="highlight tab tab-js "> < code > < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'https://pg-api.fly.dev/tables'</ span > , {
286
+ < span class ="hljs-attr "> method</ span > : < span class ="hljs-string "> 'GET'</ span > ,
287
+ < span class ="hljs-attr "> headers</ span > : {
288
+ < span class ="hljs-string "> 'pg'</ span > : { < span class ="hljs-string "> "host"</ span > : < span class ="hljs-string "> "DB_HOST"</ span > , < span class ="hljs-string "> "password"</ span > : < span class ="hljs-string "> "DB_PASSWORD"</ span > }
289
+ }
290
+ })
291
+ </ code > </ pre >
292
+ < p > < code > GET /tables</ code > </ p >
293
+ < p > < em > Get all tables</ em > </ p >
294
+ < h1 id ="pg-api-plugins "> Plugins</ h1 >
295
+ < p > View and manage your Postgres plugins.</ p >
296
+ < h2 id ="getplugins "> getPlugins</ h2 >
297
+ < p > < a id ="get-plugins "> </ a > </ p >
298
+ < blockquote >
299
+ < p > GET /plugins</ p >
300
+ </ blockquote >
301
+ < pre class ="highlight tab tab-sh "> < code > curl -X GET https://pg-api.fly.dev/plugins \
302
+ -H < span class ="hljs-string "> 'Content-Type: application/json'</ span > \
303
+ -H < span class ="hljs-string "> 'pg: { "host": "DB_HOST", "password": "DB_PASSWORD" }'</ span >
304
+ </ code > </ pre >
305
+ < pre class ="highlight tab tab-js "> < code > < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'https://pg-api.fly.dev/plugins'</ span > , {
306
+ < span class ="hljs-attr "> method</ span > : < span class ="hljs-string "> 'GET'</ span > ,
307
+ < span class ="hljs-attr "> headers</ span > : {
308
+ < span class ="hljs-string "> 'pg'</ span > : { < span class ="hljs-string "> "host"</ span > : < span class ="hljs-string "> "DB_HOST"</ span > , < span class ="hljs-string "> "password"</ span > : < span class ="hljs-string "> "DB_PASSWORD"</ span > }
309
+ }
310
+ })
311
+ </ code > </ pre >
312
+ < p > < code > GET /plugins</ code > </ p >
313
+ < p > < em > Get all plugins</ em > </ p >
314
+ < h1 id ="pg-api-config "> Config</ h1 >
315
+ < p > View and manage your Postgres config.</ p >
215
316
< h2 id ="getconfig "> getConfig</ h2 >
216
- < p > < a id ="opIdConfig "> </ a > </ p >
317
+ < p > < a id ="config "> </ a > </ p >
217
318
< blockquote >
218
319
< p > GET /config</ p >
219
320
</ blockquote >
220
- < pre class ="highlight tab tab-shell "> < code > curl -X GET http ://localhost:1337 /config
221
- </ code > </ pre >
222
- < pre class =" highlight tab tab-http " > < code > < span class ="hljs-keyword " > POST </ span > < span class =" hljs-string " > http://localhost:1337/config </ span > HTTP/1.1
321
+ < pre class ="highlight tab tab-sh "> < code > curl -X GET https ://pg-api.fly.dev /config \
322
+ -H < span class =" hljs-string " > 'Content-Type: application/json' </ span > \
323
+ -H < span class ="hljs-string " > 'pg: { "host": "DB_HOST", "password": "DB_PASSWORD" }' </ span >
223
324
</ code > </ pre >
224
- < pre class ="highlight tab tab-javascript "> < code >
225
- < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'http://localhost:1337/config'</ span > )
325
+ < pre class ="highlight tab tab-js "> < code > < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'https://pg-api.fly.dev/config'</ span > , {
326
+ < span class ="hljs-attr "> method</ span > : < span class ="hljs-string "> 'GET'</ span > ,
327
+ < span class ="hljs-attr "> headers</ span > : {
328
+ < span class ="hljs-string "> 'pg'</ span > : { < span class ="hljs-string "> "host"</ span > : < span class ="hljs-string "> "DB_HOST"</ span > , < span class ="hljs-string "> "password"</ span > : < span class ="hljs-string "> "DB_PASSWORD"</ span > }
329
+ }
330
+ })
226
331
</ code > </ pre >
227
332
< p > < code > GET /config</ code > </ p >
228
333
< p > < em > Get your Postgres version information</ em > </ p >
229
334
< h2 id ="getversion "> getVersion</ h2 >
230
- < p > < a id ="opIdConfigVersion "> </ a > </ p >
335
+ < p > < a id ="config-version "> </ a > </ p >
231
336
< blockquote >
232
337
< p > GET /config/version</ p >
233
338
</ blockquote >
234
- < pre class ="highlight tab tab-shell "> < code > curl -X GET http ://localhost:1337 /config/version
235
- </ code > </ pre >
236
- < pre class =" highlight tab tab-http " > < code > < span class ="hljs-keyword " > POST </ span > < span class =" hljs-string " > http://localhost:1337/config/version </ span > HTTP/1.1
339
+ < pre class ="highlight tab tab-sh "> < code > curl -X GET https ://pg-api.fly.dev /config/version \
340
+ -H < span class =" hljs-string " > 'Content-Type: application/json' </ span > \
341
+ -H < span class ="hljs-string " > 'pg: { "host": "DB_HOST", "password": "DB_PASSWORD" }' </ span >
237
342
</ code > </ pre >
238
- < pre class ="highlight tab tab-javascript "> < code >
239
- < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'http://localhost:1337/config/version'</ span > )
343
+ < pre class ="highlight tab tab-javascript "> < code > < span class ="hljs-keyword "> const</ span > data = < span class ="hljs-keyword "> await</ span > fetch(< span class ="hljs-string "> 'https://pg-api.fly.dev/config/version'</ span > , {
344
+ < span class ="hljs-attr "> method</ span > : < span class ="hljs-string "> 'GET'</ span > ,
345
+ < span class ="hljs-attr "> headers</ span > : {
346
+ < span class ="hljs-string "> 'pg'</ span > : { < span class ="hljs-string "> "host"</ span > : < span class ="hljs-string "> "DB_HOST"</ span > , < span class ="hljs-string "> "password"</ span > : < span class ="hljs-string "> "DB_PASSWORD"</ span > }
347
+ }
348
+ })
240
349
</ code > </ pre >
241
350
< p > < code > GET /config/version</ code > </ p >
242
351
< p > < em > Get your Postgres version information</ em > </ p >
@@ -248,15 +357,11 @@ <h2 id="getversion">getVersion</h2>
248
357
< div class ="lang-selector ">
249
358
250
359
251
- < a href ="# " data-language-name ="shell "> Shell</ a >
252
-
253
-
254
-
255
- < a href ="# " data-language-name ="http "> HTTP</ a >
360
+ < a href ="# " data-language-name ="sh "> Shell</ a >
256
361
257
362
258
363
259
- < a href ="# " data-language-name ="javascript "> JavaScript</ a >
364
+ < a href ="# " data-language-name ="js "> JavaScript</ a >
260
365
261
366
262
367
</ div >
0 commit comments