Deliveries
Return a Delivery.
Parameters
idpath integerRequired
Return a Delivery by specific
id
.includequery string
Include associations (delimited with comma). Available associations: business
{
const res = await fetch(`${BASE_URL}/api/v1/deliveries/${id}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)});
const data = await res.json();
}
{
"data": {
"id": "b81e8fb8-c511-463d-ac30-f61217599771",
"type": "deliveries",
"links": {
"self": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771"
},
"attributes": {
"code": "CH-1207",
"currency": "GBP",
"free-from-cents": 2500,
"price-cents": 250
},
"relationships": {
"business": {
"links": {
"self": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771/relationships/business",
"related": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771/business"
}
}
}
}
}
Request Object
The required Request Object used for CRUD. The only difference is with Update Delivery you need to provide a Delivery id
.
{
"data": {
"type": "deliveries",
"attributes": {
"code": "",
"price_cents": "",
"free_from_cents": "",
},
"relationships": {
"business": {
"id": "62a05bd2-2f0e-4bac-8f8b-63947f4df16f",
"type": "business"
}
}
}
}
Create Delivery
Create a Delivery.
Parameters
dataformData, objectRequired
Form Data needed when creating a new Delivery.
typestringRequired
Provide Delivery
type
. Current selection is only deliveries.attributesformData, objectRequired
Attributes object.
codestringRequired
Delivery region code
price_centsintegerRequired
Price in cents (currency taken from the business)
free_from_centsinteger
Delivery is free if order reached this amount
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/deliveries`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)});
const data = await res.json();
}
{
"data": {
"id": "b81e8fb8-c511-463d-ac30-f61217599771",
"type": "deliveries",
"links": {
"self": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771"
},
"attributes": {
"code": "CH-1207",
"currency": "GBP",
"free-from-cents": 2500,
"price-cents": 250
},
"relationships": {
"business": {
"links": {
"self": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771/relationships/business",
"related": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771/business"
}
}
}
}
}
Update Delivery
Update a Delivery
Parameters
idpath integerRequired
Update a Delivery by specific
id
.dataformData, objectRequired
Form Data needed when updating a Delivery.
idstringRequired
Provide Delivery
id
.typestringRequired
Provide Delivery
type
. Current selection is only deliveries.attributesformData, object
Attributes object.
codestring
Delivery region code
free_from_centsinteger
Delivery is free if order reached this amount
price_centsinteger
Price in cents (currency taken from the business)
{
const res = await fetch(`${BASE_URL}/api/v1/deliveries/${id}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)});
const data = await res.json();
}
{
"data": {
"id": "b81e8fb8-c511-463d-ac30-f61217599771",
"type": "deliveries",
"links": {
"self": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771"
},
"attributes": {
"code": "CH-1207",
"currency": "GBP",
"free-from-cents": 5000,
"price-cents": 250
},
"relationships": {
"business": {
"links": {
"self": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771/relationships/business",
"related": "/deliveries/b81e8fb8-c511-463d-ac30-f61217599771/business"
}
}
}
}
}
Delete Delivery
Delete a Delivery.
Parameters
idpath integerRequired
Delete a Delivery by specific
id
.
{
const res = await fetch(`${BASE_URL}/api/v1/deliveries/${id}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}});
const data = await res.json();
}