ERP Integration
Askås API provides building opportunities for ERP- integrations: order retrieval, order status updates, and shipping information. This page explains the recommended integration pattern for orders and highlights the areas that still need Askås confirmation.
What is supported today
Order retrieval
- Use
orderConnectionto fetch orders. - You can filter orders using
OrdersFilterwithcreatedFrom,createdTo, andstatusId.
Order status
- Each order exposes
Order.status. OrdersFilter.statusIdlets you fetch only orders with a specific status.- Standard status ids are covered in the summary section below.
Tracking and shipment data
Order.shippingDetailsis available on theOrderobject.Shipping.shipmentscontains one or moreShipmentrecords.- Each
Shipmentcan provide:trackingNumbertrackingLinkdeliveredAterpReference a value that can be set on the shipping method in Askås admin.
order->feescan also contain a reference to the Askås ID of the shipping method when mapping is handled on the business systems side.
Order updates and shipment updates
- Order updates are performed through
batchUpdateOrders. BatchOrderInputsupports:id(order id)statusviaBatchOrderStatusInput(id)shipmentsviaBatchOrderShipmentInput
- This means ERP can update order status and attach shipment/tracking information.
Standard order statuses
Askås has standard status values for common order flow handling:
0= New order1= Received by ERP6= Sent order99= Canceled order
When an order moves to 6, Askås usually activates payment. When an order moves to 99, the payment is canceled. Payment handling may depend on the payment provider.
Note: Other status values are shop-specific. Merchants can configure custom statuses based on their own store setup and workflow.
Recommended ERP sync patterns
Incremental order fetch
There are two common approaches:
-
Fetch new orders by status
- Fetch orders with
statusId: 0. - After processing, update orders to
statusId: 1so Askås knows they have been imported.
- Fetch orders with
-
Fetch based on timestamps
- Save the timestamp of the last successful sync.
- Use
createdFromwith that timestamp in the next run.
Example: fetch orders with shipping and status
query getOrders($createdFrom: DateTime, $statusId: Int) {
orderConnection(first: 50, filter: {createdFrom: $createdFrom, statusId: $statusId}) {
edges {
node {
id
createdAt
status {
id
name {
value
}
}
shippingAddress {
firstName
lastName
streetAddress
postalCode
city
}
shippingDetails {
serviceCode
deliveryAt
shipments {
trackingNumber
trackingLink
deliveredAt
}
}
}
}
pageInfo {
endCursor
}
totalCount
}
}
Example: update order status and shipment tracking
mutation updateOrder($input: [BatchOrderInput!]!) {
batchUpdateOrders(input: $input) {
id
status
}
}
Example variables:
{
"input": [
{
"id": 23444,
"status": { "id": 6 },
"shipments": [
{
"trackingNumber": "123456789"
}
]
}
]
}
Example: update stock balance for multiple products
For ERP inventory sync, you can update only the stock balance for several products in the same batch request.
Askås decrements stock when an order is placed, so there is normally no need to synchronize every stock change back on each order. Use this batch update for periodic inventory reconciliation, or corrections rather than per-order delta sync.
mutation updateProductStock {
batchUpdateProducts(
input: [
{id: "prod123", stock: 10},
{id: "prod124", stock: 5}
]
) {
id
status
}
}
Example variables:
{
"input": [
{"id": "prod123", "stock": 10},
{"id": "prod124", "stock": 5}
]
}