Skip to main content

Create a batch

Endpoint Overview

This API endpoint provides a detailed overview of the endpoint responsible for creating a batch within the Inventory module of the Juleb ERP.

Endpoint Details

  • Method: POST
  • URL: /api/v1/inventory/batch

Parameters

  • Path Parameters: None
  • Query Parameters: None
{
"name": string,
"product_id": integer,
"company_id": integer,
"life_date": string,
"production_date": 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/batch`, {
name: "api test",
product_id: 7,
company_id: 1,
life_date: "2026-01-01",
production_date: "2023-01-01"
}, {
headers: {
'accept': '*/*',
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});

Response

{
"data": {
"id": 43737,
"message_main_attachment_id": null,
"name": "api test",
"ref": null,
"product_id": 7,
"product_uom_id": 1,
"note": null,
"company_id": 1,
"create_uid": 2,
"create_date": "2024-09-03T22:55:05.085Z",
"write_uid": 2,
"write_date": "2024-09-03T22:55:05.085Z",
"life_date": "2026-01-01T00:00:00.000Z",
"use_date": null,
"removal_date": null,
"alert_date": null,
"product_expiry_reminded": null,
"gti_number": null,
"production_date": "2023-01-01T00:00:00.000Z",
"batch_number": null,
"gl_number": null,
"serial_id": null,
"scanned_code": "5555012",
"scanned_code_numeric": null,
"lot_code": "012",
"lot_number": "5555012",
"batch_name": null,
"stock_inventory_tag_id": null,
"is_frozen": null,
"j_batch_qty": 0,
"is_frozen_transfer": null,
"j_life_date_str": "2026-01-01",
"product_package_id": null,
"j_sale_price": null
}
}