The order history can be accessed via the url GET http://<server name>:<odata port>/<service tier name>/api/BEterna/Export/v2.0/companies(<company system id>)/orderHistoryHeaders?$filter=webshopChannelCode eq '<webshop-channel-code>'&$expand=orderHistoryLines
. The filter on the webshop channel code is mandatory. The response is a JSON with all order histories with applied filters.
{
"@odata.context": "http://<server name>:<odata port>/<service tier name>/api/BEterna/Export/v2.0/$metadata#companies(<company system id>)/orderHistoryHeaders",
"value": [
{
"@odata.etag": "W/\"JzE5OzY3MzQyNDA5MjYyOTQ3NDM1MzUxOzAwOyc=\"",
"systemId": "97e56105-d308-ed11-be57-f3948ca414fc",
"webshopOrderNo": "D-000001",
"webshopChannelCode": "B2B",
"salesOrderNo": "101007",
"createdAt": "2022-07-17T22:00:00Z",
"type": "Invoice",
"postedDocumentNo": "",
"trackingNo": "",
"orderHistoryLines": [
{
"@odata.etag": "W/\"JzIwOzE3NjA3ODAzMjg5NDE5ODk0MTU3MTswMDsn\"",
"systemId": "428d515f-d308-ed11-be57-f3948ca414fc",
"orderNo": "101007",
"orderLineNo": 10000,
"belongsTo": "",
"belongsToLineNo": 0,
"itemNo": "1896-S",
"variantCode": "",
"quantity": 2,
"lineAmount": 100,
"postedDocumentNo": "",
"postedDocumentLineNo": 0
},
{
"@odata.etag": "W/\"JzE5OzUwMTQwNzM2NjA4MDMzNjQ0NjMxOzAwOyc=\"",
"systemId": "65468b91-d308-ed11-be57-f3948ca414fc",
"orderNo": "101007",
"orderLineNo": 20000,
"belongsTo": "",
"belongsToLineNo": 0,
"itemNo": "1906-S",
"variantCode": "",
"quantity": 1,
"lineAmount": 89,
"postedDocumentNo": "",
"postedDocumentLineNo": 0
}
]
},
{
"@odata.etag": "W/\"JzIwOzEyNDE2ODUyNDQzNTM1NDIzOTI5MTswMDsn\"",
"systemId": "5d16d2ab-d308-ed11-be57-f3948ca414fc",
"webshopOrderNo": "D-000002",
"webshopChannelCode": "B2B",
"salesOrderNo": "101011",
"createdAt": "2022-07-23T22:00:00Z",
"type": "Return",
"postedDocumentNo": "",
"trackingNo": "",
"orderHistoryLines": [
{
"@odata.etag": "W/\"JzIwOzE4MTUyNDIyMDc0ODA3ODg0NjI1MTswMDsn\"",
"systemId": "77544ebc-d308-ed11-be57-f3948ca414fc",
"orderNo": "101011",
"orderLineNo": 0,
"belongsTo": "",
"belongsToLineNo": 0,
"itemNo": "1996-S",
"variantCode": "",
"quantity": 5,
"lineAmount": 124.36,
"postedDocumentNo": "",
"postedDocumentLineNo": 0
}
]
}
]
}
The fields of header are documented in the following table.
field | data type | content |
---|---|---|
systemId |
GUID | distinct identifier for an order history header record |
webshopOrderNo |
Code[20] | the webshop order no. |
webshopChannelCode |
Code[20] | the webshop channel code |
salesOrderNo |
Code[20] | the sales order no. |
createdAt |
DateTime | the created at field |
type |
Option | the order type |
postedDocumentNo |
Code[20] | the posted document no. |
trackingNo |
Code[20] | the tracking no. |
The fields of lines are documented in the following table.
field | data type | content |
---|---|---|
systemId |
GUID | distinct identifier for an order history line record |
orderNo |
Code[20] | the sales order no. |
orderLineNo |
Integer | the sales order line no. |
belongsTo |
Code[20] | the return receipt no. |
belongsToLineNo |
Integer | the return receipt line no. |
itemNo |
Code[20] | the item no. |
variantCode |
Code[10] | the item variant no. |
quantity |
Decimal | the quantity |
lineAmount |
Decimal | the line amount |
postedDocumentNo |
Code[20] | the posted document no. |
postedDocumentLineNo |
Integer | the posted document line no. |