This endpoint allows inline editing of individual purchase order line fields, including stock handling for quantity and received quantity changes.
https://easycms.fi/public_api/set_purchase_order_line/application/json
Authorization1: {API_TOKEN}username, password, account
| Parameter | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | API username |
| password | string | Yes | API password |
| account | string | Yes | Account domain |
| id | integer | Yes | Purchase order ID |
| purchase_line_id | integer | Yes | The purchase_line_id of the line to update |
| field | string | Yes | Field name to update (see below) |
| value | mixed | Yes | The new value for the field |
| Field | Value Type | Description | Stock Impact |
|---|---|---|---|
quantity |
float | Ordered quantity | Adjusts stockcoming |
received_quantity |
float | Received quantity | Adjusts stockcurrent + stockdiary by difference |
unit_price_buy |
float | Buy price per unit | None |
discount |
float | Discount percentage | None |
location_id |
integer | Destination location | Moves stock between locations |
vat_id_buy |
integer | VAT ID for buy price | None |
line_note |
string | Note for this line | None |
arrival_date |
date | Expected arrival date | None |
best_before_date |
date | Best before date | None |
stock_type_id |
integer | Stock type | None |
quantity changes: Adjusts stockcoming for coming ordersreceived_quantity changes: Adjusts stockcurrent and creates a stockdiary entry for the differencelocation_id changes: Moves stock between locations (affects stockcoming or stockcurrent)
As of API version 3.08, received quantities use a two-phase confirmation flow:
received_quantity stages the value but does NOT move stock immediatelyset_purchase_order_confirm endpointWhen you set received_quantity via this endpoint:
set_purchase_order_confirm to move stock for the new quantity| Line State | received_quantity Edit |
Stock Impact |
|---|---|---|
| Pending | Stages new value | No stock movement |
| Confirmed | Un-confirms, reverses old stock, stages new value | Old stock reversed, new value deferred |
| After confirm call | N/A | Stock moved for confirmed qty |
curl -X POST 'https://easycms.fi/public_api/set_purchase_order_line' \
-H 'Authorization1: TOKEN' \
-H 'Content-Type: application/json' \
-d '{"username":"USERNAME","password":"PASSWORD","account":"ACCOUNT_ID","id":1,"purchase_line_id":5,"field":"received_quantity","value":10}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://easycms.fi/public_api/set_purchase_order_line",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'username' => 'USERNAME',
'password' => 'PASSWORD',
'account' => 'ACCOUNT_ID',
'id' => 1,
'purchase_line_id' => 5,
'field' => 'received_quantity',
'value' => 10
]),
CURLOPT_HTTPHEADER => array("Authorization1: TOKEN", "Content-Type: application/json"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://easycms.fi/public_api/set_purchase_order_line"
headers = {"Authorization1": "TOKEN", "Content-Type": "application/json"}
payload = {
"username": "USERNAME",
"password": "PASSWORD",
"account": "ACCOUNT_ID",
"id": 1,
"purchase_line_id": 5,
"field": "received_quantity",
"value": 10
}
response = requests.post(url, headers=headers, json=payload)
print(response.text)
HttpClient client = HttpClient.newHttpClient();
String body = """
{"username":"USERNAME","password":"PASSWORD","account":"ACCOUNT_ID","id":1,"purchase_line_id":5,"field":"received_quantity","value":10}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://easycms.fi/public_api/set_purchase_order_line"))
.headers("Authorization1", "TOKEN", "Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
const https = require('https');
const data = JSON.stringify({
username: 'USERNAME', password: 'PASSWORD', account: 'ACCOUNT_ID',
id: 1, purchase_line_id: 5, field: 'received_quantity', value: 10
});
const options = {
hostname: 'easycms.fi',
path: '/public_api/set_purchase_order_line',
method: 'POST',
headers: { 'Authorization1': 'TOKEN', 'Content-Type': 'application/json' }
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => { data += chunk; });
res.on('end', () => { console.log(data); });
});
req.on('error', (e) => { console.error(e); });
req.write(data);
req.end();