Skip to content

Commit 8d39016

Browse files
committed
Formats the documentation
1 parent a1ee3be commit 8d39016

File tree

4 files changed

+316
-101
lines changed

4 files changed

+316
-101
lines changed

docs/index.html

Lines changed: 152 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<meta charset="utf-8">
88
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
99
<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>
1111

1212
<style>
1313
</style>
@@ -44,7 +44,7 @@
4444
<!-- Generator: Widdershins v4.0.1 -->
4545
</head>
4646

47-
<body data-languages="[&quot;shell&quot;,&quot;http&quot;,&quot;javascript&quot;]">
47+
<body data-languages="[&quot;sh&quot;,&quot;js&quot;]">
4848
<a href="#" id="nav-button">
4949
<span>
5050
NAV
@@ -57,15 +57,11 @@
5757
<div class="lang-selector">
5858

5959

60-
<a href="#" data-language-name="shell">Shell</a>
60+
<a href="#" data-language-name="sh">Shell</a>
6161

6262

6363

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>
6965

7066

7167
</div>
@@ -80,7 +76,7 @@
8076
<ul class="toc-list-h1">
8177

8278
<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>
8480

8581
</li>
8682

@@ -90,7 +86,12 @@
9086
<ul class="toc-list-h2">
9187

9288
<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>
9495

9596
</li>
9697

@@ -118,7 +119,35 @@
118119
</li>
119120

120121
<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>
122151

123152
<ul class="toc-list-h2">
124153

@@ -141,23 +170,59 @@
141170

142171
<ul class="toc-footer">
143172

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>
145174

146175
</ul>
147176

148177
</div>
149178
<div class="page-wrapper">
150179
<div class="dark-box"></div>
151180
<div class="content">
152-
<h1 id="swagger-pg-api">@supabase/pg-api</h1>
181+
<h1 id="about">Postgres API</h1>
153182
<blockquote>
154183
<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>
155184
</blockquote>
156185
<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>
157192
<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>
160200
</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>
161226
<h2 id="authentication">Authentication</h2>
162227
<p>Authentication is not provided. Make sure you use this inside a secure network or put your own API proxy in front.</p>
163228
<h1 id="swagger-pg-api-query">Query</h1>
@@ -167,30 +232,26 @@ <h2 id="query">query</h2>
167232
<blockquote>
168233
<p>POST /query</p>
169234
</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 \
171236
-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>
172238
</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>, {
180241
<span class="hljs-attr">method</span>: <span class="hljs-string">'POST'</span>,
181242
<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>
183244
})
184245
</code></pre>
185-
<p><code>POST /query</code></p>
186-
<p><em>Execute an SQL query</em></p>
187246
<blockquote>
188-
<p>BODY</p>
247+
<p>Example body</p>
189248
</blockquote>
190249
<pre class="highlight tab tab-json"><code>{
191250
<span class="hljs-attr">"query"</span>: <span class="hljs-string">"SELECT * FROM your_table LIMIT 1;"</span>
192251
}
193252
</code></pre>
253+
<p><code>POST /query</code></p>
254+
<p><em>Execute an SQL query</em></p>
194255
<h3 id="addpet-parameters">Parameters</h3>
195256
<table>
196257
<thead>
@@ -210,33 +271,81 @@ <h3 id="addpet-parameters">Parameters</h3>
210271
</tr>
211272
</tbody>
212273
</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>
215316
<h2 id="getconfig">getConfig</h2>
216-
<p><a id="opIdConfig"></a></p>
317+
<p><a id="config"></a></p>
217318
<blockquote>
218319
<p>GET /config</p>
219320
</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>
223324
</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+
})
226331
</code></pre>
227332
<p><code>GET /config</code></p>
228333
<p><em>Get your Postgres version information</em></p>
229334
<h2 id="getversion">getVersion</h2>
230-
<p><a id="opIdConfigVersion"></a></p>
335+
<p><a id="config-version"></a></p>
231336
<blockquote>
232337
<p>GET /config/version</p>
233338
</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>
237342
</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+
})
240349
</code></pre>
241350
<p><code>GET /config/version</code></p>
242351
<p><em>Get your Postgres version information</em></p>
@@ -248,15 +357,11 @@ <h2 id="getversion">getVersion</h2>
248357
<div class="lang-selector">
249358

250359

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>
256361

257362

258363

259-
<a href="#" data-language-name="javascript">JavaScript</a>
364+
<a href="#" data-language-name="js">JavaScript</a>
260365

261366

262367
</div>

docs/source/images/logo.png

-13.2 KB
Loading

0 commit comments

Comments
 (0)