Accept Suggested Orders¶
Bulk-updates the document status for all line items belonging to one or more purchase orders. Primarily used to accept system-generated Suggested orders and transition them to an active status such as Open.
Request¶
Required privilege: Procurement / Edit
Content-Type: application/json
CSRF header required: X-XSRF-TOKEN
Request Body¶
Fields¶
| Field | Type | Required | Description |
|---|---|---|---|
status |
string | Yes | Target document status to apply to all matched line items (e.g., Open, Received) |
parentIds |
array of integers | Yes | Non-empty list of PurchaseOrderList IDs whose detail lines will be updated |
Behaviour¶
- All
PurchaseOrderDetailsrecords whose parent PO ID appears inparentIdsare updated to the specifiedstatus. - The PO header status is not modified by this endpoint - only line items are affected.
- This is a bulk operation; partial success is not supported. If any validation fails, no records are updated.
Response¶
Success¶
HTTP/1.1 200 OK
Content-Type: application/json
{
"message": "Update successful",
"rows_updated": 12
}
| Field | Type | Description |
|---|---|---|
message |
string | Confirmation message |
rows_updated |
integer | Number of detail lines updated |
Error - Missing Fields¶
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": "Missing required field: status"
}
Error - Empty parentIds¶
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": "parentIds must be a non-empty list of integers"
}
Code Examples¶
curl¶
CSRF=$(grep csrf_access_token cookies.txt | awk '{print $NF}')
curl -b cookies.txt -X PUT \
https://acme.knosc.com/api/purchase-order-details-accept-suggested-orders \
-H "Content-Type: application/json" \
-H "X-XSRF-TOKEN: $CSRF" \
-d '{
"status": "Open",
"parentIds": [42, 43, 44]
}'
Python¶
csrf_token = session.cookies.get("csrf_access_token")
# Accept a batch of suggested orders
suggested_po_ids = [42, 43, 44]
response = session.put(
"https://acme.knosc.com/api/purchase-order-details-accept-suggested-orders",
headers={"X-XSRF-TOKEN": csrf_token},
json={
"status": "Open",
"parentIds": suggested_po_ids,
},
)
result = response.json()
if response.status_code == 200:
print(f"Accepted {result['rows_updated']} suggested order lines.")
else:
print(f"Error: {result['error']}")
Typical Workflow¶
# 1. List all POs in 'Suggested' status
response = session.get("https://acme.knosc.com/api/purchase-order")
rows = response.json()["data"]["rows"]
suggested_ids = [
po["id"] for po in rows
if po["PO List Document Status"] == "Suggested"
]
if suggested_ids:
# 2. Accept all of them in one call
csrf_token = session.cookies.get("csrf_access_token")
response = session.put(
"https://acme.knosc.com/api/purchase-order-details-accept-suggested-orders",
headers={"X-XSRF-TOKEN": csrf_token},
json={"status": "Open", "parentIds": suggested_ids},
)
print(response.json())
Related¶
- List Purchase Orders - Filter by
Suggestedstatus - Update Purchase Order - Update individual PO status