Upsert a product from a shop
PUT
/products/import
const url = 'https://example.com/products/import';const options = { method: 'PUT', headers: { cookie: 'bottle.session_token=<bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"source":"woocommerce","externalId":"example","externalVariantId":"example","externalSku":"example","name":"example","unitPrice":1,"vatRate":1,"shortCode":"example","updatePrice":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/products/import \ --header 'Content-Type: application/json' \ --cookie bottle.session_token=<bottle.session_token> \ --data '{ "source": "woocommerce", "externalId": "example", "externalVariantId": "example", "externalSku": "example", "name": "example", "unitPrice": 1, "vatRate": 1, "shortCode": "example", "updatePrice": true }'Matched on the shop’s own id, so running the same sync twice leaves one product rather than two. The price is written when the product is first seen and left alone afterwards unless updatePrice says otherwise, because Bottle holds the rates agreed with particular customers and a shop knows nothing about them. A listing that comes back un-archives the product.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
source
required
string
externalId
required
string
externalVariantId
string | null
externalSku
string | null
name
required
string
unitPrice
required
Pence, excluding VAT. Shops usually quote inclusive: convert before sending.
integer
vatRate
integer
shortCode
string | null
updatePrice
boolean
Responses
Section titled “Responses”The product, created or updated
Media typeapplication/json
object
id
required
UUID v7
string format: uuid
name
required
string
shortCode
required
string | null
sku
required
string | null
unitPrice
required
Pence, excluding VAT.
integer
vatRate
required
VAT in basis points: 2000 is 20%, 500 is 5%, 0 is zero rated.
integer
charge
required
string | null
chargePeriod
required
string | null
chargeForProductId
required
UUID v7
string | null format: uuid
gasTypeId
required
UUID v7
string | null format: uuid
weightKg
required
number | null
volumeLitres
required
integer | null
notes
required
string | null
links
required
Array<object>
object
source
required
string
externalId
required
string
externalVariantId
required
string | null
externalSku
required
string | null
lastSyncedAt
required
string | null format: date-time
archivedAt
required
string | null format: date-time
createdAt
required
string format: date-time
updatedAt
required
string format: date-time
Example
{ "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "name": "19kg propane", "shortCode": "19", "sku": "PROP-19", "unitPrice": 5400, "vatRate": 2000, "charge": "deposit", "chargePeriod": "once", "chargeForProductId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "gasTypeId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "weightKg": 38.5, "volumeLitres": 60, "links": [ { "source": "woocommerce", "externalId": "1043" } ]}Not signed in
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Not a member, or without the permission this needs
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed
Media typeapplication/json
object
error
required
string
message
required
string
issues
required
Array<object>
object
path
required
string
message
required
string
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}