Export orders
The export orders API can be used to export orders into another system
caution
If you have not already read the Introduction to Export APIs then it's recommended to start there to understand how to use the export APIs. The Export APIs is designed to keep track of what has already been exported. If you are looking for a normal API, refer to the Core Order API instead.
Get orders that have not been exported
Endpoint: GET /v10/orders/export
You can add a date+time to the query string using the parameter not_exported_since
in order to re-export orders that
have already been exported
Available properties for filtering: created_at
, updated_at
(NOTE: These filters have to be added using our Filters Syntax, however system_id
and not_export_since
should be added as a normal query string parameter)
Available nested resources for including: lines
The endpoint will fetch all orders that have not been exported yet
Available query parameters
Parameter | Data type | Required | Default | Description |
---|---|---|---|---|
system_id | string | Yes | A string identifying the system the orders should be exported to. This is used so orders can be exported to multiple systems. | |
not_exported_since | datetime (UTC) | Current time | Add this to re-export orders that have already been exported. Note the timezone should be UTC | |
include_not_approved | integer | 0 | Export draft orders that have not been approved yet. 0 = only export approved orders. 1 = include draft orders in export | |
include_cancelled | integer | 0 | Export cancelled orders in the export. 0 = do not include cancelled orders. 1 = include cancelled orders | |
include_archived | integer | 0 | Export archived orders in the export. 0 = do not include archived orders. 1 = include archived orders | |
filter_groups | Array<Filters> | Optional filters to add. See which filters are available above |
Data of response
Parameter | Required | Default | Description |
---|---|---|---|
orders.* | Yes | An array of object order |
Mark orders as exported
Endpoint: POST /v10/orders/mark-as-exported
Parameter | Data type | Required | Default | Description |
---|---|---|---|---|
orders | Array<Orders that have been exported> | Yes | Orders that have been exported. You can at a max mark 10 orders at a time |
Orders that have been exported
Parameter | Data type | Required | Default | Description |
---|---|---|---|---|
order_id | int | Yes | The ID of the order that has been exported | |
system_id | string | Yes | A string identifying the system the orders should be exported to. This is used so orders can be exported to multiple systems. | |
regulate_inventory | boolean | Yes | Should TRAEDE regulated inventory when the order is export? Read more under Regulate Inventory on Export | |
note | string | Any notes regarding the sync you want to add. These will be displayed in the timeline of the order |
Regulate inventory on export
If you are NOT invoicing in TRAEDE
E.g. if you are using the Order Export API to build your own ERP integration. In such a case it is recommended to have TRAEDE regulate the inventory when an order is exported. The flow can be described like this
- In TRAEDE there is 2 types of inventory: In stock and Available. In stock is our total inventory, and available is how much we have available to sell. Let's imagine we have SKU 1000 with In stock = 10, available = 10
- An order is made for 1 pcs. of SKU 1000. In stock is still 10, but available is now 9
- The order is now exported to the ERP. If we use the
POST /v10/orders/mark-as-exported
endpoint withregulate_inventory=false
then TRAEDE will just leave the order and inventory as-is. If you call the endpoint withregulate_inventory=true
then TRAEDE will remove the pieces from In Stock and Archive the order in TRAEDE. So In Stock will be 9 and available 9.
If you are invoicing in TRAEDE
You should not use the regulate_inventory
since TRAEDE will regulate the inventory once the invoice is issued. Until the invoice is issued TRAEDE will reserve the ordered quantities so that they are removed from the available inventory