# Forecast Orders
The base endpoint for forecast orders is api/forecast
.
# GET Order List
GET
responds with a list of all forecast orders. The endpoint accepts a search
parameter where filters may be added. Here is an example of how to get all open forecast orders:
"search": json.dumps({
"filters": {
"include": {
"FO List Document Status": ["Open", "Partially Shipped", "Partially Received", "Shipped"],
},
"exclude": {}
},
})
One may also exclude the Received
forecast orders, which are archived orders:
"search": json.dumps({
"filters": {
"include": {},
"exclude": {
"FO List Document Status": ["Received"]
}
},
})
The response of the GET
method has the following structure:
{
"data": {
"headers": {
"details": Array<TableColumn>,
"parent": Array<TableColumn>,
},
"rows": Array<ForecastListRow>
}
}
Where ForecastListRow
is defined as:
{
id: int,
"Customer Id": int,
"Customer Name": string,
"Customer Number": string,
"FO List Document Status": string,
"FO List Number": string,
"FO List Order Date": string,
"FO List Quantity": int,
"FO Total Items": int
}
Here is a python function for getting all forecast orders:
def get_forecast_orders(base_url: str, headers: dict):
params = {
"search": json.dumps({
"filters": {
"include": {
"FO List Document Status": ["Open", "Partially Shipped", "Partially Received", "Shipped"],
"FO Details Document Status": ["Open", "Shipped"],
},
},
})
}
response = requests.get(f"{ base_url }/forecast", params=params, headers=headers)
assert response.status_code == codes.ok
return response.json()
# GET Order Details
The endpoint for an order contents or rows is api/forecast/<int:id>
. Where id
is an order internal identifier. The internal identifier may be found in ForecastListRow
as field id
.
A search
filter may also be added in order to exclude the archive, e.g.:
"search": json.dumps({
"filters": {
"include": {},
"exclude": {
"FO Details Document Status": ["Received"]
}
},
})
The response of the GET
method has the following structure:
{
"data": {
"headers": Array<TableColumn>,
"rows": Array<ForecastDetailsRow>
}
}
ForecastDetailsRow
contains the following fields:
{
"id": int,
"External Item Id": int,
"External Item Number": string,
"FO Details ASN Status": string,
"FO Details Document Status": string,
"FO Details ETA Date": YYYY-MM-DD,
"FO Details Order Date": YYYY-MM-DD,
"FO Details Priority": int,
"FO Details Quantity": float,
"FO Details Ship Date": YYYY-MM-DD | null,
"FO Details Tracking": string,
"FO Details Unique Id": string,
"Item Description": string,
"Item Id": int,
"Item Number": string,
"Ship To Id": int,
"Ship To Name": string,
"Ship To Number": string,
"Sub Item Description": string | null,
"Sub Item Id": int | null,
"Sub Item Number": string | null,
"Warehouse Id": int,
"Warehouse Name": string,
"Warehouse Number": string,
"Z1": string,
}
Here is a python function for getting the details or rows of a forecast order with identifier order_id
:
def get_forecast_lines(base_url: str, order_id: int, headers: dict):
params = {
"search": json.dumps({
"filters": {
"include": {
"FO Details Document Status": ["Open", "Shipped"],
},
"exclude": {}
},
})
}
response = requests.get(f"{ base_url }/forecast/{ order_id }", params=params, headers=headers)
assert response.status_code == codes.ok
return response.json()