Skip to main content

Update an Active Ingredient

Endpoint Overview​

This API endpoint provides a detailed overview of the endpoint responsible for updating an existing active ingredient within the Inventory module of the Juleb ERP. All fields are optional — only send the fields you want to change.

Endpoint Details​

  • Method: PATCH
  • URL: /api/v1/inventory/active_ingredient/{id}

Parameters​

  • Path Parameters:
    • id (string, required): The ID of the active ingredient to update.
  • Query Parameters: None

Request Body​

{
"name": string,
"description": string
}

Response​

  • 202 Accepted: Successfully updated the record.
  • 400 Bad Request: Bad request.
  • 401 Unauthorized: Unauthorized.
  • 404 Not Found: Record with the provided ID not found.

Response Body​

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

Example​

Request​

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

axios.patch(`https://${accountName}.juleb.com/api/v1/inventory/active_ingredient/12`, {
description: 'Common analgesic, antipyretic, and mild NSAID alternative'
}, {
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": "Paracetamol",
"description": "Common analgesic, antipyretic, and mild NSAID alternative"
}
}