Request Object
The required Request Object used for CRUD. The only difference is with Update Table you need to provide a Table id
.
{
"data": {
"type": "tables",
"attributes": {
"number": "",
"number_of_seats": 0,
},
"relationships": {
"business": {
"id": "62a05bd2-2f0e-4bac-8f8b-63947f4df16f",
"type": "business"
}
}
}
}
Create Table
Create a table of a business.
Parameters
dataformData, objectRequired
Form Data needed when creating a new table of a business.
typestringRequired
Provide Table
type
. Current selection is only tables.attributesformData, objectRequired
Attributes object.
numberstringRequired
Table number.
number_of_seatsintegerRequired
Number of seats at table.
relationshipsformData, object
Relationships object with
business
object.businessformData, object
Add a Business relationships link.
idstring
Related Business
id
.typestring
Business
type
; business.
{
const res = await fetch(`${BASE_URL}/api/v1/tables`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)});
const data = await res.json();
}
Update Table
Update table
Parameters
idpath integerRequired
Update a Table by specific
id
.dataformData, objectRequired
Form Data needed when updating a Table.
idstringRequired
Provide Delivery
id
.typestringRequired
Provide Delivery
type
. Current selection is only deliveries.attributesformData, object
Attributes object.
numberstring
Table number.
number_of_seatsinteger
Number of seats at table.
{
const res = await fetch(`${BASE_URL}/api/v1/tables/${id}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)});
const data = await res.json();
}
Delete Table
Delete a Table.
Parameters
idpath integerRequired
Delete a Table by specific
id
.
{
const res = await fetch(`${BASE_URL}/api/v1/tables/${id}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}});
const data = await res.json();
}