Skip to content

Get Scenario Purchase Order Details

Returns purchase order detail lines associated with a specific scenario analysis. Used by the scenario planning module to project procurement data under hypothetical conditions.


Request

GET /api/scenario-purchase-order-details/{scenario_id}

Required privilege: Manufacturing / View

Path Parameters

Parameter Type Required Description
scenario_id integer Yes Internal scenario analysis identifier

Example Request

GET /api/scenario-purchase-order-details/7 HTTP/1.1
Host: acme.knosc.com
Cookie: access_token_cookie=<token>

Response

200 OK
Content-Type: application/json

Returns purchase order detail lines scoped to the given scenario. The structure mirrors the details array from Get Purchase Order.

{
  "data": {
    "rows": [
      {
        "id": 201,
        "scenario_id": 7,
        "Item Number": "ITEM-A",
        "Item Description": "Widget Assembly - Type A",
        "Warehouse Number": "WH-01",
        "Warehouse Name": "Main Distribution Center",
        "PO Details Quantity": 150,
        "PO Details ETA Date": "2024-04-10",
        "PO Details Document Status": "Open"
      }
    ]
  },
  "tags": {},
  "extra": {}
}

Error - Scenario Not Found

HTTP/1.1 404 Not Found
Content-Type: application/json

{
  "Message": "Scenario #7 not found.",
  "Code": "Scenario.NotFound"
}

Code Examples

curl

curl -b cookies.txt "https://acme.knosc.com/api/scenario-purchase-order-details/7"

Python

scenario_id = 7

response = session.get(
    f"https://acme.knosc.com/api/scenario-purchase-order-details/{scenario_id}"
)

if response.status_code == 200:
    rows = response.json()["data"]["rows"]
    print(f"Scenario {scenario_id} has {len(rows)} PO detail lines.")
else:
    error = response.json()
    print(f"Error: {error['Code']} - {error['Message']}")

Notes

  • This endpoint requires the Manufacturing / View privilege, unlike the other purchase order endpoints which require Procurement / View.
  • Scenario PO details reflect projected data and may differ from live purchase orders.