Add Picking Lines
Endpoint Overview
This API endpoint provides a detailed overview of the endpoint responsible for adding one or more product lines to an existing picking within the Inventory module of the Juleb ERP.
Endpoint Details
- Method: PATCH
- URL:
/api/v1/inventory/picking/{id}/lines
Parameters
- Path Parameters:
id(string, required): The ID of the picking to add lines to.
- Query Parameters: None
Request Body
The lines to add must be wrapped under a PickingLines array (at least one entry required),
using the same line shape used when creating a picking:
{
"PickingLines": [
{
"productId": integer,
"default_code": string,
"productQty": integer,
"batch": string,
"expiry": string
}
]
}
See Create a delivery for the full line field reference.
Response
- 202 Accepted: The requested resource has been updated.
- 400 Bad Request: Bad request (e.g.
picking with id {id} is not found). - 401 Unauthorized: Unauthorized.
Response Body
An array with one confirmation message (or error object) per line, in the same order they were submitted:
[
"product with id {productId} added successfully with id {moveId}"
]
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/picking/11004/lines`, {
PickingLines: [
{
productId: 34970,
productQty: 5
}
]
}, {
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 '{
"PickingLines": [
{
"productId": 34970,
"productQty": 5
}
]
}' \
"https://$ACCOUNT_NAME.juleb.com/api/v1/inventory/picking/11004/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/picking/11004/lines'
headers = {
'accept': '*/*',
'Authorization': f'******',
'Content-Type': 'application/json'
}
data = {
'PickingLines': [
{
'productId': 34970,
'productQty': 5
}
]
}
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 = "{"
+ "\"PickingLines\": [{"
+ "\"productId\": 34970,"
+ "\"productQty\": 5"
+ "}]"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://" + accountName + ".juleb.com/api/v1/inventory/picking/11004/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
[
"product with id 34970 added successfully with id 55123"
]