Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Refinement of Documentation

Angelicodd3033b7d160
diff --git a/web/docs/library/getting-started.mdx b/web/docs/library/getting-started.mdx
index eaac76c120f..50750768723 100755
--- a/web/docs/library/getting-started.mdx
+++ b/web/docs/library/getting-started.mdx
@@ -7,7 +7,6 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
## Including Supabase
----
<Tabs
defaultValue="nodeJs"
values={[
@@ -18,27 +17,21 @@ import TabItem from '@theme/TabItem';
<TabItem value="nodeJs">
```js
-import { Supabase } from "@supabase/supabase-js";
+import { createClient } from "@supabase/supabase-js";
```
</TabItem>
<TabItem value="py">
```py
-from supabase import Supabase
+from supabase import createClient
```
</TabItem>
</Tabs>
## Initializing
----
-### Supabase(supabaseURL, supabaseKey, options?)
-This is used to initialize an instance of a Supabase object. From here, you would be able
-to access all of the features provided by Supabase.
-
-### Examples
<Tabs
defaultValue="nodeJs"
values={[
@@ -49,18 +42,22 @@ to access all of the features provided by Supabase.
<TabItem value="nodeJs">
```js
-const supabase = Supabase("https://supabase.io/xyzcompany", "1a2b-3c4d-5e6f-7g8h");
+const base = createClient("https://xyzcompany.supabase.io", "1a2b-3c4d-5e6f-7g8h");
```
</TabItem>
<TabItem value="py">
```py
-supabase = Supabase("https://supabase.io/xyzcompany", "1a2b-3c4d-5e6f-7g8h")
+base = createClient("https://xyzcompany.supabase.io", "1a2b-3c4d-5e6f-7g8h")
```
</TabItem>
</Tabs>
+### createClient(supabaseURL, supabaseKey, options?)
+This is used to initialize an instance of a `createClient` object. From here, you would be able
+invoke all the other features and functions provided by Supabase.
+
### Method arguments
#### supabaseURL
`required` string
@@ -72,8 +69,9 @@ Your unique Supabase Key.
#### options
`optional` object
+- @tbc
| Parameter | Data Type | Description |
| ----------- | --------- | ----------- |
-| @todo | | |
+| @tbc | | |
diff --git a/web/docs/library/restful/delete.mdx b/web/docs/library/restful/delete.mdx
index 9d1688b3e25..32448c0f458 100644
--- a/web/docs/library/restful/delete.mdx
+++ b/web/docs/library/restful/delete.mdx
@@ -1,6 +1,6 @@
---
id: delete
-title: 'Remove Rows'
+title: 'Delete Rows'
---
@todo short Description
diff --git a/web/docs/library/restful/get.mdx b/web/docs/library/restful/get.mdx
index a86dcecfad0..224807f0a4e 100644
--- a/web/docs/library/restful/get.mdx
+++ b/web/docs/library/restful/get.mdx
@@ -1,6 +1,6 @@
---
id: get
-title: 'Fetch Your Data'
+title: 'Read Rows'
---
@todo short Description
diff --git a/web/docs/library/restful/post.mdx b/web/docs/library/restful/post.mdx
index 955440f03f3..181e2261658 100644
--- a/web/docs/library/restful/post.mdx
+++ b/web/docs/library/restful/post.mdx
@@ -1,60 +1,162 @@
---
id: post
-title: 'Create New Rows'
+title: 'Create Rows'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-@todo short Description
-
-## The basics
-
<Tabs
- defaultValue="js"
+ defaultValue="nodeJs"
values={[
- { label: 'JS', value: 'js', },
+ { label: 'Node.js', value: 'nodeJs', },
{ label: 'Python', value: 'py', },
]
}>
-<TabItem value="js">
+<TabItem value="nodeJs">
```js
-import { createClient } from "@supabase/supabase-js";
+const fetchUsers = async () => {
+ try {
+ let users = await base
+ .post(
+ "users",
+ [
+ { name: "Richard Hendrix" },
+ { name: "Elrich Bachman" }
+ ],
+ )
+ return users
+ } catch (error) {
+ console.log('Error:', error)
+ }
+}
-// Connect to Supabase
-const base = createClient(process.env.SUPABASE_URL, {
- apikey: process.env.SUPABASE_KEY
-});
+```
+</TabItem>
-// Subscribe to realtime updates
-const result = await base.post("users", { name: 'paul'})
+<TabItem value="py">
+
+```py
+# TODO
```
+</TabItem>
+</Tabs>
+
+## createClient.post(tableName, data, options?)
+Given the `options?` set, this posts `data` into the selected `tableName` in your database.
+
+## Method arguments
+#### tableName
+`required` string
+Name of table in the database where data will be saved.
+
+#### data
+`required` array
+Array of rows of type `object` which contain information to be saved into the selected table.
+
+
+#### options
+`optional` object
+- headers
+`optional` object
+Custom headers to be sent. A complete list of headers can be found [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers).
+
+- withCredentials
+`optional` boolean
+Determines the ability to send cookies from the origin.
+
+- timeout
+`optional` integer
+Specifies the amount of time in milliseconds before the request times out.
+
+- auth
+`optional` object
+Allows authentications through given credentials.
+| Parameter | Required | Data Type | Description |
+| ---------- | ---------- | --------- | ----------- |
+| username | `required` | string | Username |
+| password | `required` | string | Password |
+
+
+## Example
+
+### With all options specified
+<Tabs
+ defaultValue="nodeJs"
+ values={[
+ { label: 'Node.js', value: 'nodeJs', },
+ { label: 'Python', value: 'py', },
+ ]
+}>
+<TabItem value="nodeJs">
+
+```js
+const fetchUsers = async () => {
+ try {
+ let users = await base
+ .post(
+ "users",
+ [
+ { name: "Richard Hendrix" },
+ { name: "Elrich Bachman" }
+ ],
+ {
+ headers:{
+
+ },
+ withCredentials: true,
+ timeout: 1000,
+ auth:{
+ username: "password"
+ password: "password"
+ }
+ }
+ )
+ return users
+ } catch (error) {
+ console.log('Error:', error)
+ }
+}
+
+```
</TabItem>
+
<TabItem value="py">
```py
-# @todo
+# TODO
```
</TabItem>
-
</Tabs>
-## Examples
+## Responses
+
+### 201 Created
+The request has succeeded. New resource created will be returned:
+
+```json
+{
+ "rows": [
+ { "name": "Richard Hendrix" },
+ { "name": "Elrich Bachman"}
+ ]
+}
-@todo various examples
+```
-## Options
+### 400 Bad request
+An invalid syntax or configuration was sent.
-| Parameter | Default | Description |
-| --------- | ------- | ------------------------------------------- |
-| @todo | | All options |
+### 401 Unauthorized
+Either authentication is required or invalid credentials were provided under the `auth` object.
-## Returns
+### 404 Not found
+Requested resource cannot be found.
-#### 200: Success
+### 500 Internal Server Error
+The server was unable to encounter the situation it encountered.
-@todo: all return scenarios
diff --git a/web/sidebars.js b/web/sidebars.js
index 72b7247c94f..c42bc2d7df4 100755
--- a/web/sidebars.js
+++ b/web/sidebars.js
@@ -24,8 +24,8 @@ module.exports = {
type: "category",
label: "RESTful",
items: [
- "library/restful/get",
"library/restful/post",
+ "library/restful/get",
"library/restful/patch",
"library/restful/delete"
]
diff --git a/web/src/theme/DocItem/index.js b/web/src/theme/DocItem/index.js
index 5aabcc87af1..a038c85c988 100644
--- a/web/src/theme/DocItem/index.js
+++ b/web/src/theme/DocItem/index.js
@@ -232,7 +232,7 @@ function DocItem(props) {
<Headings headings={DocContent.rightToc} />
</div>
)}
- <div className="section">
+ {/* <div className="section">
<div className="title">Resources</div>
<ul className="contents">
{editUrl && (
@@ -257,7 +257,7 @@ function DocItem(props) {
</li>
)}
</ul>
- </div>
+ </div> */}
{(lastUpdatedAt || lastUpdatedBy) && (
<div className="section">
Last updated{' '}