Purchase Orders | Confirm Received Order

Confirm Purchase Order Received Quantity

This endpoint confirms received quantities on purchase order lines, triggering stock movement for confirmed lines.

Endpoint and Method

  • Endpoint: https://easycms.fi/public_api/set_purchase_order_confirm/
  • Method: POST
  • Content-Type: application/json



Authentication

  • Header: Authorization1: {API_TOKEN}
  • Body parameters: username, password, account



Request Parameters

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 No Specific line to confirm. If omitted, confirms ALL pending lines.
confirmed_by string No Identifier of who confirmed. Defaults to "API_USER".



Behavior

  • Only works on purchase orders with status 200 (received)
  • Confirms pending lines and moves stock from tbl_stockcurrent and tbl_stockdiary
  • The amount moved is the line's received_quantity — NOT the ordered quantity (report actual amounts via set_purchase_order line field received_quantity)
  • Skips lines that are already confirmed or have received_quantity <= 0
  • Creates permanent audit trail via KLogger (who, when, what)

Correcting a confirmed line (v3.16+): to change the quantity of an already-confirmed line, re-send the line to set_purchase_order with the NEW received_quantity (ordered quantity must stay unchanged). The API reverses the previous confirmed stock movement, un-confirms the line and stages the new quantity — then call this endpoint again to apply the corrected amount.



Response Format

{
    "status": "success",
    "message": "2 line(s) confirmed",
    "data": {
        "confirmed_count": 2,
        "results": [
            {
                "success": true,
                "purchase_line_id": 123,
                "received_quantity": 50.0,
                "confirmed_by": "API_USER",
                "confirmed_at": "2026-04-30 14:30:00"
            }
        ]
    }
}



Error Responses

HTTP Code Error Code Description
400 INVALID_STATUS Purchase order is not in received status
404 NOT_FOUND Purchase order not found
400 MISSING_REQUIRED_FIELDS Missing id parameter



Call Examples

### Confirm a single line ```bash curl -X POST "https://easycms.fi/public_api/set_purchase_order_confirm/" \ -H "Content-Type: application/json" \ -H "Authorization1: YOUR_API_TOKEN" \ -d '{ "username": "your_username", "password": "your_password", "account": "your_account", "id": 123, "purchase_line_id": 456, "confirmed_by": "[email protected]" }' ``` ### Confirm all pending lines ```bash curl -X POST "https://easycms.fi/public_api/set_purchase_order_confirm/" \ -H "Content-Type: application/json" \ -H "Authorization1: YOUR_API_TOKEN" \ -d '{ "username": "your_username", "password": "your_password", "account": "your_account", "id": 123, "confirmed_by": "[email protected]" }' ```