Skip to main content

Create a Product Category

Endpoint Overview​

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

Endpoint Details​

  • Method: POST
  • URL: /api/v1/inventory/product-category

Parameters​

  • Path Parameters: None
  • Query Parameters: None

Request Body​

{
"name": string,
"parent_id": integer,
"removal_strategy_id": integer,
"sync_with_pos_category": boolean,
"pos_categ_id": integer,
"j_category_ar": string,
"j_category_num": string,
"j_category_code": string
}

Field Reference​

FieldTypeRequiredDescription
namestringYesCategory name.
parent_idintegerNoParent category ID, for nested category hierarchies.
removal_strategy_idintegerNoRemoval strategy ID (e.g. FIFO/FEFO) applied to stock in this category.
sync_with_pos_categorybooleanNoAutomation field. When true, keeps this category linked/in sync with the POS category given in pos_categ_id.
pos_categ_idintegerNoRelated POS Category ID, used together with sync_with_pos_category.
j_category_arstringNoArabic category name.
j_category_numstringNoCategory number.
j_category_codestringNoCategory code.

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/product-category`, {
name: 'Pain Relief',
parent_id: 3,
sync_with_pos_category: true,
pos_categ_id: 8
}, {
headers: {
accept: '*/*',
Authorization: `TOKEN`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});

Response​

{
"data": {
"id": 12,
"name": "Pain Relief",
"parent_id": 3,
"pos_categ_id": 8
}
}