Get Many Batches
Endpoint Overview
This endpoint is designed to retrieve information about multiple batches from the Juleb ERP system. It allows you to efficiently fetch data for a group of batches in a single request, rather than making individual requests for each batch.
Endpoint Details
- Method: GET
- URL:
/api/v1/inventory/batch
Parameters
- Path Parameters: None
- Query Parameters:
fields(string, not required): Fields to include in the response separated by comma. If not provided, all fields are returned.filter(string, not required): Apply conditions to filter the data returned.limit(integer, not required): Limit the number of records returned. Default is 10, Max is 1000.page(integer, not required): Page the records returned. Default is 1.
Response
- 200 OK: Successfully retrieved the record.
- 400 Bad Request: Invalid parameters.
- 401 Unauthorized: Authentication required.
Response Body
{
"data": [
...records
],
"meta": {
"count": integer,
"total": integer
},
"pagination": {
"previousPage": integer | null,
"currentPage": integer,
"nextPage": integer | null,
"totalPages": integer
}
}
Example
Request
- NodeJS
- curl
- python
- java
curl -X GET \
-H "accept: */*" \
-H "Authorization: Bearer $API_KEY" \
"https://$ACCOUNT_NAME.juleb.com/api/v1/inventory/batch?fields=name%2Clot_number%2Clot_code%2Cproduct_id%2Clife_date%2Cj_batch_qty&filter=life_date%3E2025-01-01&page=1&limit=10"
const axios = require('axios');
const accountName = process.env.ACCOUNT_NAME;
const apiKey = process.env.API_KEY;
axios.get(`https://${accountName}.juleb.com/api/v1/inventory/batch`, {
headers: {
'accept': '*/*',
'Authorization': `Bearer ${apiKey}`
},
params: {
fields: 'name,lot_number,lot_code,product_id,life_date,j_batch_qty',
filter: 'life_date>2025-01-01',
page: 1,
limit: 10
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
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");
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://" + accountName + ".juleb.com/api/v1/inventory/batch?fields=name,lot_number,lot_code,product_id,life_date,j_batch_qty&filter=life_date>2025-01-01&page=1&limit=10"))
.header("accept", "*/*")
.header("Authorization", "Bearer " + apiKey)
.GET()
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
if (response.statusCode() == 200) {
System.out.println(response.body());
} else {
System.out.println("Error: " + response.statusCode() + ", " + response.body());
}
}
}
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/batch'
headers = {
'accept': '*/*',
'Authorization': f'Bearer {api_key}'
}
params = {
'fields': 'name,lot_number,lot_code,product_id,life_date,j_batch_qty',
'filter': 'life_date>2025-01-01',
'page': 1,
'limit': 10
}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
print(response.json())
else:
print(f'Error: {response.status_code}', response.text)
Response
{
"data": [
{
"name": "BP_2680008",
"lot_number": "BP_2680008",
"lot_code": "008",
"product_id": 18462,
"life_date": "2025-01-04T00:00:00.000Z",
"j_batch_qty": 1
},
{
"name": "ERWER",
"lot_number": "MED_893002",
"lot_code": "002",
"product_id": 9673,
"life_date": "2025-01-05T00:00:00.000Z",
"j_batch_qty": 30
},
{
"name": "YA0221",
"lot_number": "VS_1001",
"lot_code": "001",
"product_id": 7,
"life_date": "2025-01-12T00:00:00.000Z",
"j_batch_qty": 0
},
{
"name": "testingAPI",
"lot_number": "BP_13989005",
"lot_code": "005",
"product_id": 10,
"life_date": "2025-01-15T00:00:00.000Z",
"j_batch_qty": 0
},
{
"name": "5RZVWXW8R0",
"lot_number": null,
"lot_code": "",
"product_id": 20482,
"life_date": "2025-02-01T00:00:00.000Z",
"j_batch_qty": 1
},
{
"name": "SE5E",
"lot_number": "MED_1857001",
"lot_code": "001",
"product_id": 20482,
"life_date": "2025-02-01T00:00:00.000Z",
"j_batch_qty": -3
},
{
"name": "5RZVWX1W8R0",
"lot_number": null,
"lot_code": "",
"product_id": 20482,
"life_date": "2025-02-01T00:00:00.000Z",
"j_batch_qty": 0
},
{
"name": "5RYVWX1W8R0",
"lot_number": null,
"lot_code": "",
"product_id": 20482,
"life_date": "2025-02-01T00:00:00.000Z",
"j_batch_qty": -1
},
{
"name": "5RYVbX1W8R0",
"lot_number": null,
"lot_code": "",
"product_id": 20482,
"life_date": "2025-02-01T00:00:00.000Z",
"j_batch_qty": -1
},
{
"name": "0000006730027",
"lot_number": "0000006730027",
"lot_code": "027",
"product_id": 34973,
"life_date": "2025-02-05T00:00:00.000Z",
"j_batch_qty": 0
}
],
"meta": {
"count": 10,
"total": 231
},
"pagination": {
"previousPage": null,
"currentPage": 1,
"nextPage": 2,
"totalPages": 24
}
}