Save a reviewed yard stock take
POST
/stock-takes
const url = 'https://example.com/stock-takes';const options = { method: 'POST', headers: { cookie: '__Host-bottle.session_token=<__Host-bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"id":"019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f","locationId":"019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f","lines":[{"productId":"019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f","expectedFull":1,"expectedEmpty":1,"full":1,"empty":1,"damagedFull":0,"damagedEmpty":0}],"note":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/stock-takes \ --header 'Content-Type: application/json' \ --cookie __Host-bottle.session_token=<__Host-bottle.session_token> \ --data '{ "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "locationId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "lines": [ { "productId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "expectedFull": 1, "expectedEmpty": 1, "full": 1, "empty": 1, "damagedFull": 0, "damagedEmpty": 0 } ], "note": "example" }'Counts exclude damaged cylinders. Damage and other adjustments are saved together. Blank counts otherwise leave stock unchanged. Refuses stale figures so they can be reviewed again. The client-generated id makes retrying safe even after a lost response.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
id
required
UUID v7
string format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8flocationId
required
UUID v7
string format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8flines
required
Array<object>
object
productId
required
UUID v7
string format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8fexpectedFull
required
integer
expectedEmpty
required
integer
full
required
integer | null
empty
required
integer | null
damagedFull
integer
damagedEmpty
integer
note
string | null
Responses
Section titled “Responses”Saved
Media typeapplication/json
object
id
required
UUID v7
string format: uuid
locationId
required
UUID v7
string format: uuid
locationName
required
string
byUserId
required
string | null
byName
required
string | null
createdAt
required
string format: date-time
note
required
string | null
lines
required
Array<object>
object
productId
required
UUID v7
string format: uuid
productName
required
string
shortCode
required
string | null
expectedFull
required
integer
expectedEmpty
required
integer
full
required
integer | null
empty
required
integer | null
damagedFull
integer
damagedEmpty
integer
Example
{ "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "locationId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "lines": [ { "productId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "damagedFull": 0, "damagedEmpty": 0 } ]}Sign in
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Not allowed to take stock in this business
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Yard or product unavailable
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Stock changed since counting began
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Check the counts
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" } ]}