Update Inventory Adjustment Lines
Endpoint Overview
This API endpoint provides a detailed overview of the endpoint responsible for updating the counted quantity (and count date) of one or more lines on an inventory adjustment, within the Inventory module of the Juleb ERP. This is how you record the physical count results before validating.
Endpoint Details
- Method: PATCH
- URL:
/api/v1/inventory/inventory-adjustments/{id}/lines
Parameters
- Path Parameters:
id(string, required): The ID of the inventory adjustment whose lines are being updated.
- Query Parameters: None
Request Body
{
"inventoryLines": [
{
"id": integer,
"product_qty": number,
"inventory_date": string
}
]
}
Field Reference
| Field | Type | Required | Description |
|---|---|---|---|
inventoryLines | array | Yes | At least one line to update. |
inventoryLines[].id | integer | Yes | The inventory adjustment line ID (from Get Inventory Adjustment Lines). |
inventoryLines[].product_qty | number | Yes | The physically counted quantity for this line. |
inventoryLines[].inventory_date | string (date) | Yes | The date the count was performed. |
Errors
invalid ids there is no inventory line ids for ids [...]— one or moreids ininventoryLinesdon't belong to this inventory adjustment.
Response
- 202 Accepted: Successfully updated the lines.
- 400 Bad Request: Bad request.
- 401 Unauthorized: Unauthorized.
Response Body
An array of the updated lines (batch_number, id, product_qty, inventory_date):
[
{
"batch_number": null,
"id": 9001,
"product_qty": 118,
"inventory_date": "2024-09-03T00:00:00.000Z"
}
]
Example
Request
- NodeJS
- curl
- python
- java
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/inventory-adjustments/44/lines`, {
inventoryLines: [
{
id: 9001,
product_qty: 118,
inventory_date: '2024-09-03'
}
]
}, {
headers: {
accept: '*/*',
Authorization: `TOKEN`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
curl -X PATCH \
-H "accept: */*" \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{
"inventoryLines": [
{
"id": 9001,
"product_qty": 118,
"inventory_date": "2024-09-03"
}
]
}' \
"https://$ACCOUNT_NAME.juleb.com/api/v1/inventory/inventory-adjustments/44/lines"
import os
import requests
account_name = os.getenv('ACCOUNT_NAME')
api_key = os.getenv('API_KEY')
url = f'https://{account_name}.juleb.com/api/v1/inventory/inventory-adjustments/44/lines'
headers = {
'accept': '*/*',
'Authorization': f'******',
'Content-Type': 'application/json'
}
data = {
'inventoryLines': [
{
'id': 9001,
'product_qty': 118,
'inventory_date': '2024-09-03'
}
]
}
response = requests.patch(url, headers=headers, json=data)
if response.status_code == 202:
print(response.json())
else:
print(f'Error: {response.status_code}', response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
public class Main {
public static void main(String[] args) throws Exception {
String accountName = System.getenv("ACCOUNT_NAME");
String apiKey = System.getenv("API_KEY");
String json = "{"
+ "\"inventoryLines\": [{"
+ "\"id\": 9001,"
+ "\"product_qty\": 118,"
+ "\"inventory_date\": \"2024-09-03\""
+ "}]"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://" + accountName + ".juleb.com/api/v1/inventory/inventory-adjustments/44/lines"))
.header("accept", "*/*")
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
if (response.statusCode() == 202) {
System.out.println(response.body());
} else {
System.out.println("Error: " + response.statusCode() + ", " + response.body());
}
}
}
Response
[
{
"batch_number": null,
"id": 9001,
"product_qty": 118,
"inventory_date": "2024-09-03T00:00:00.000Z"
}
]