Skip to main content

Create a Scrap

Endpoint Overview​

This API endpoint provides a detailed overview of the endpoint responsible for scrapping stock (removing damaged or unsellable stock from inventory) within the Inventory module of the Juleb ERP. A single call can create one or many scraps at once.

Endpoint Details​

  • Method: POST
  • URL: /api/v1/inventory/picking/scrap

Parameters​

  • Path Parameters: None
  • Query Parameters: None

Request Body​

The request body must wrap the scrap (or scraps) to create under a PartnerPicking key - either a single object, or an array to create several in one call. Same shape and fields as Create a delivery (companyId, partnerId / partner_code, reason, note, origin, autoValidate, autoCreateBatch, rsd_deserialization, global_import, international_export, lines[]). partnerId is typically omitted for scraps.

{
"PartnerPicking": {
"companyId": integer,
"reason": string,
"note": string,
"origin": string,
"autoValidate": boolean,
"autoCreateBatch": boolean,
"lines": [
{
"productId": integer,
"default_code": string,
"productQty": integer,
"batch": string,
"expiry": string
}
]
}
}

Response​

  • 201 OK: Successfully created the record.
  • 400 Bad Request: Bad request.
  • 401 Unauthorized: Unauthorized.

Response Body​

{
"data": {
...record fields
}
}

Example​

Request​

const axios = require('axios');
const accountName = process.env.ACCOUNT_NAME;
const apiKey = process.env.API_KEY;

axios.post(`https://${accountName}.juleb.com/api/v1/inventory/picking/scrap`, {
PartnerPicking: {
companyId: 1,
reason: "Expired stock",
lines: [
{
productId: 34969,
productQty: 10,
batch: "13200001"
}
]
}
}, {
headers: {
'accept': '*/*',
'Authorization': `TOKEN`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});

Response​

{
"data": {
"id": 11030,
"name": "Demo/SCRAP/00009",
"origin": null,
"note": null,
"state": "assigned",
"company_id": 1,
"code": "Expired stock"
}
}