Post POS Order
Endpoint Overview
This API endpoint provides a detailed overview of the endpoint responsible for creating a POS Order within the POS module of the Juleb ERP.
Endpoint Details
- Method: POST
- URL:
/api/v1/pos/order
Parameters
- Path Parameters: None
- Query Parameters: None
{
"pos_session_id": integer,
"pricelist_id": integer,
"payment_method_id": integer,
"partner_id": integer,
"lines": [
{
"product_id": integer,
"qty": integer,
"lot_name": string,
"qr_code":string[],
"discount_by_percent": integer
}
]
}
Response
- 201 OK: Successfully created the record.
- 400 Bad Request: Bad request.
- 401 Unauthorized: Unauthorized.
Response Body
{
"data": {
"id": integer,
"pos_reference": string
}
}
Example
Request
- NodeJS
- curl
- python
- java
const axios = require('axios');
const accountName = process.env.ACCOUNT_NAME;
const apiKey = process.env.API_KEY;
axios.post(`https://${accountName}.juleb.com/api/v1/pos/order`, {
pos_session_id: 1799,
pricelist_id: 1,
payment_method_id: 5,
partner_id: false,
lines: [
{
product_id: 91,
qty: 1,
lot_name: "923190297493",
discount_by_percent: 0
qr_code:["010628602300100021557558631092319029749317270915"]
}
]
}, {
headers: {
'accept': '*/*',
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
curl -X POST \
-H "accept: */*" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pos_session_id": 1799,
"pricelist_id": 1,
"payment_method_id": 5,
"partner_id": 1,
"lines": [
{
"product_id": 91,
"qty": 1,
"lot_name": "923190297493",
"discount_by_percent": 0
qr_code:["010628602300100021557558631092319029749317270915"]
}
]
}' \
"https://$ACCOUNT_NAME.juleb.com/api/v1/pos/order"
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/pos/order'
headers = {
'accept': '*/\_',
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
data = {
pos_session_id: 1799,
pricelist_id: 1,
payment_method_id: 5,
partner_id: false,
lines: [
{
product_id: 91,
qty: 1,
lot_name: "923190297493",
discount_by_percent: 0,
qr_code:["010628602300100021557558631092319029749317270915"]
}
]
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
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;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
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 = "{\n" +
" \"pos_session_id\": 1799,\n" +
" \"pricelist_id\": 1,\n" +
" \"payment_method_id\": 5,\n" +
" \"partner_id\": 1,\n" +
" \"lines\": [\n" +
" {\n" +
" \"product_id\": 91,\n" +
" \"qty\": 1,\n" +
" \"lot_name\": \"923190297493\",\n" +
" \"discount_by_percent\": 0\n", +
" \"qr_code\":[\n" +
" \"010628602300100021557558631092319029749317270915\"] \n" +
" }\n" +
" ]\n" +
"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://" + accountName + ".juleb.com/api/v1/pos/order"))
.header("accept", "*/*")
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.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());
}
}
}
Response
[
{
"id": 7155,
"pos_reference": "Order 01799-006-0004"
}
]