The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Changes to RESTful Documentation
Angelico40cea1c5dd7a
diff --git a/web/docs/library/delete.mdx b/web/docs/library/delete.mdxindex fa806dfc6cd..4ab3d8971cb 100644--- a/web/docs/library/delete.mdx+++ b/web/docs/library/delete.mdx@@ -7,7 +7,7 @@ title: 'Deleting'import DummyData from '../common/DummyData.mdx'import Collapsable from '../../src/components/Collapsable'import CommonResponses from '../common/CommonResponses.mdx'-import CommonFilters from '../common/CommonFilters.mdx'+import CommonFilters from '../common/CommonFilters'import FromFunction from '../common/FromFunction.mdx'@@ -22,7 +22,7 @@ We will be using these tables as reference for our examples:This example how to delete a city:<!-- prettier-ignore -->-```js {8-9}+```js {7-10}import { createClient } from '@supabase/supabase-js'const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h')@@ -30,8 +30,9 @@ const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h'const updateCountryName = async () => {try {let values = await supabase+ .from('cities').match({ id: 666 })- .delete('cities', { name: 'Mordor' })+ .delete()return values} catch (error) {@@ -53,15 +54,12 @@ const updateCountryName = async () => {<FromFunction verb='delete' />### `delete()`-```js+```js {2}supabase- .delete(tableName, options?)+ .delete(options?)```--##### tableName `:string`-Name of table in the database with the data that should be deleted.--##### options `:object?`++#### `options: object?````jsconst options = {@@ -74,7 +72,41 @@ const options = {## Filtering-<CommonFilters verb="delete" />+### `filter()`+<CommonFilters filter='filter'/>++### `match()`+<CommonFilters filter='match'/>++### `eq()`+<CommonFilters filter='eq'/>++### `gt()`+<CommonFilters filter='gt'/>++### `lt()`+<CommonFilters filter='lt'/>++### `gte()`+<CommonFilters filter='gte'/>++### `lte()`+<CommonFilters filter='lte'/>++### `like()`+<CommonFilters filter='like'/>++### `ilike()`+<CommonFilters filter='ilike'/>++### `is()`+<CommonFilters filter='is'/>++### `in()`+<CommonFilters filter='in'/>++### `not()`+<CommonFilters filter='not'/>## Responsesdiff --git a/web/docs/library/get.mdx b/web/docs/library/get.mdxindex a1a51a2a321..88d8b02a965 100644--- a/web/docs/library/get.mdx+++ b/web/docs/library/get.mdx@@ -28,7 +28,7 @@ const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h'const getCities = async () => {try {let cities = await supabase- .get('cities')+ .from('cities')return cities} catch (error) {console.log('Error: ', error)@@ -66,7 +66,7 @@ const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h'const getCities = async () => {try {let cities = await supabase- .get('cities')+ .from('cities').select('name')return cities} catch (error) {@@ -106,7 +106,7 @@ const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h'const getCountries = async () => {try {let countries = await supabase- .get('countries')+ .from('countries').select(`name,cities {@@ -174,30 +174,18 @@ Calling `getCountries()` will return the following response:### `from()`<FromFunction verb='get' />-### `get()`--<!-- prettier-ignore -->-```js {2}-supabase- .get(tableName)-```--##### tableName `:string`-Name of table in the database that will be read from.--------### `select()`<!-- prettier-ignore -->```js {3}supabase- .get(tableName)+ .from(tableName).select(columnQuery)```-##### columnQuery `:string`+If not used, all columns in the table will be returned.++#### `columnQuery: string`A comma separated list of columns. For example `select('id, name')`If a foreign key constraint exists between this table@@ -208,7 +196,7 @@ and another, you can also query the columns of the related table. For example `s<!-- prettier-ignore -->```jssupabase- .get('countries')+ .from('countries').select(`name,cities {@@ -227,19 +215,19 @@ supabase<!-- prettier-ignore -->```js {3}supabase- .get(tableName)+ .from(tableName).order(columnName, sortAscending, nullsFirst)```Orders your data before fetching.-##### columnName `:string`+#### `columnName: string`Name of chosen column to base the order on.-##### sortAscending `:boolean? | Default is false`+#### `sortAscending: boolean? | Default is false`Specifies whether the order will be ascending or descending.-##### nullsFirst `:boolean? | Default is false`+#### `nullsFirst: boolean? | Default is false`Specifies whether null values will be displayed first.----@@ -249,16 +237,16 @@ Specifies whether null values will be displayed first.<!-- prettier-ignore -->```js {3}supabase- .get(tableName)+ .from(tableName).range(fromIndex, toIndex)```Paginates your request.-##### fromIndex `:integer`+#### `fromIndex: integer`Index or position of the start of the specified range.-##### toIndex `:integer?`+#### `toIndex: integer?`Index or position of the end of the specified range. If not stated, all remaining rows after the starting index will be returned.----@@ -268,7 +256,7 @@ Index or position of the end of the specified range. If not stated, all remainin<!-- prettier-ignore -->```js {3}supabase- .get(tableName)+ .from(tableName).single()```@@ -276,12 +264,6 @@ Returns the first row of the table as an object and **not** as an array.----------## Filtering### `filter()`diff --git a/web/docs/library/patch.mdx b/web/docs/library/patch.mdxindex cd8056dcc1c..f087898227a 100644--- a/web/docs/library/patch.mdx+++ b/web/docs/library/patch.mdx@@ -7,7 +7,7 @@ title: 'Updating'import DummyData from '../common/DummyData.mdx'import Collapsable from '../../src/components/Collapsable'import CommonResponses from '../common/CommonResponses.mdx'-import CommonFilters from '../common/CommonFilters.mdx'+import CommonFilters from '../common/CommonFilters'import FromFunction from '../common/FromFunction.mdx'@@ -15,14 +15,12 @@ We will be using these tables as reference for our examples:<DummyData />--### Update recordThis example how to update a country:<!-- prettier-ignore -->-```js {8}+```js {7-10}import { createClient } from '@supabase/supabase-js'const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h')@@ -30,7 +28,8 @@ const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h'const updateCountryName = async () => {try {let updates = await supabase- .patch('countries', { name: 'Middle Earth' })+ .from('countries')+ .udpate({ name: 'Middle Earth' }).match({ name: 'New Zealand' })return updates@@ -53,19 +52,15 @@ const updateCountryName = async () => {<FromFunction verb='patch' />### `patch()`-```js+```js {2}supabase.patch(tableName, data, options?)```--##### tableName `:string`-Name of table in the database where data will be saved.--##### data `:object`++#### `data: object`New record values.--##### options `:object?`+#### `options: object?````jsconst options = {@@ -75,10 +70,43 @@ const options = {-----## Filtering-<CommonFilters verb="patch" />+### `filter()`+<CommonFilters filter='filter'/>++### `match()`+<CommonFilters filter='match'/>++### `eq()`+<CommonFilters filter='eq'/>++### `gt()`+<CommonFilters filter='gt'/>++### `lt()`+<CommonFilters filter='lt'/>++### `gte()`+<CommonFilters filter='gte'/>++### `lte()`+<CommonFilters filter='lte'/>++### `like()`+<CommonFilters filter='like'/>++### `ilike()`+<CommonFilters filter='ilike'/>++### `is()`+<CommonFilters filter='is'/>++### `in()`+<CommonFilters filter='in'/>++### `not()`+<CommonFilters filter='not'/>## Responsesdiff --git a/web/docs/library/post.mdx b/web/docs/library/post.mdxindex 9991b9d027c..4361573e2c5 100644--- a/web/docs/library/post.mdx+++ b/web/docs/library/post.mdx@@ -21,7 +21,7 @@ We will be using these tables as reference for our examples:This example how to create a new city:<!-- prettier-ignore -->-```js {7-8}+```js {7-11}import { createClient } from '@supabase/supabase-js'const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h')@@ -29,7 +29,8 @@ const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h'const getCities = async () => {try {let cities = await supabase- .post('cities', [+ .from('cities')+ .insert([{ name: 'The Shire', country_id: 554 }])return cities@@ -50,7 +51,7 @@ const getCities = async () => {This example how to create multiple cities with one request:<!-- prettier-ignore -->-```js {7-8}+```js {7-12}import { createClient } from '@supabase/supabase-js'const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h')@@ -58,7 +59,8 @@ const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h'const createCities = async () => {try {let cities = await supabase- .post('cities', [+ .from('cities')+ .insert([{ name: 'The Shire', country_id: 554 },{ name: 'Rohan', country_id: 554 },])@@ -83,23 +85,19 @@ const createCities = async () => {### `from()`<FromFunction verb='post' />-### `post()`-```js+### `insert()`+```js {2}supabase- .post(tableName, data, options?)+ .insert(data, options?)```-##### tableName `:string`-Name of table in the database where data will be saved.--##### data `:array`+#### `data: array`Array of rows of type `object` which contain information to be saved into the selected table.---##### options `:object?`++#### `options: object?`@todo-+---## Responses