API Examples
This page contains samples of api calls.
CustomerOrders
Minimum order using existing customer and prices from Extend Commerce
{
"orderHeader": {
"orderType": "Normal",
"orderNumberExternal": "YourOwnOrderNumber-timestamp",
"customerNumber": "Customer-123",
"askedDeliveryDate": "2019-12-25T00:00:00+02:00",
"partialDelivery": false,
"freightFree": true
},
"orderRows": [
{
"product": {
"productNumber": "Product-123"
},
"salesData": {
"quantity": 2,
"unit": "Stk"
},
"warehouse": "MainWarehouse"
}
]
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
Command to cancel an order-row:
"rowOperation": "Inactive",
(Important to also put "warehouse": "TEST", otherwise it will ad an row which is cancelled to the order)
"orderRows":
[
{
"position": 50,
"rowOperation": "Inactive",
"product": {
"productNumber": "Product-123",
"productName": "Product-123",
"productNotes": "",
"customerProductNumber": null,
"customsCommodityCode": null
},
"salesData": {
"quantity": 41.0,
"unit": "ST",
"unitPrice": 10.6778,
"vatPercent": 25.0,
"currency": "SEK",
"unitExplicitCost": null,
"listPrice": 10.6778
},
"supplyMode": "Warehouse",
"batchNumber": null,
"warehouse": "TEST",
"shipDate": "2024-10-15T15:00:00+02:00",
"expectedDeliveryDate": "2024-10-15T16:00:00+02:00",
"deliveryData": {
"quantity": 41.0,
"unit": "ST",
"unitPrice": 10.6778,
"vatPercent": 25.0,
"currency": "SEK",
"unitExplicitCost": null,
"listPrice": null
}
}
]
CustomerOrderATP
CustomerOrder with a BillOfMaterials product
Request
{"orderHeader": {
"orderType": "Normal",
"orderNumberExternal": "YourOwnOrderNumber-timestamp",
"customerNumber": "Customer-123",
"askedDeliveryDate": "2019-12-25T00:00:00+02:00",
"partialDelivery": false,
"freightFree": true
},
"orderRows": [
{
"product":
{ "productNumber": "ChristmasGift-1" },
"salesData":
{ "quantity": 3, "unit": "FRP" },
"warehouse": "MainWarehouse"
}
]
}
Response contains information about all child products in the BillOfMaterials product. The expanded child products can be recognized by the orderRows.billOfMaterialsParentRowPosition property
Partial response sample of a christmas gift containing one FRP of ginger bread:
"orderRows": [
{
"position": 10,
"subPosition": 0,
"product": {
"productNumber": "ChristmasGift-1",
"productName": "Christmas gift"
},
"salesData": {
"quantity": 3,
"unit": "FRP",
"unitPrice": 0,
"vatPercent": 25,
"currency": "SEK"
},
"supplyMode": "BillOfMaterials",
"shipDate": "2020-02-06T15:59:23.999+01:00",
"expectedDeliveryDate": "2020-02-10T16:00:00+01:00",
"deliveryData": {
"quantity": 3,
"unit": "Stk",
"unitPrice": 0,
"vatPercent": 25,
"currency": "SEK"
},
"availableBalance": 75,
"minSupplierLeadTimeHours": 24,
"billOfMaterialsParentRowPosition": null
},
{
"position": 20,
"subPosition": 0,
"product": {
"productNumber": "GingerBread",
"productName": "Ginger bread"
},
"salesData": {
"quantity": 3,
"unit": "FRP",
"unitPrice": 15,
"vatPercent": 25,
"currency": "SEK"
},
"supplyMode": "Warehouse",
"shipDate": "2020-02-06T15:59:23.999+01:00",
"expectedDeliveryDate": "2020-02-10T16:00:00+01:00",
"deliveryData": {
"quantity": 9,
"unit": "Stk",
"unitPrice": 5,
"vatPercent": 25,
"currency": "SEK"
},
"availableBalance": 225,
"minSupplierLeadTimeHours": 184,
"billOfMaterialsParentRowPosition": 10
}
]
ReturnOrders
Create complete return from order
{
"createAction": {
"action": "ReturnCompleteCustomerOrder",
"orderNumber": "OC-142"
}
}
Create complete return from order, with specifiec returnCode{
"createAction": {
"action": "ReturnCompleteCustomerOrder",
"orderNumber": "OC-142",
"returnCode": "B"
}
}
Create return order from a customer order, but override address, paymenttype and creditInvoiceAction
{
"createAction": {
"action": "ReturnCompleteCustomerOrder",
"orderNumber": "OC-142",
"returnCode": "B"
},
"header": {
"deliveryMethod": "CONS_112",
"paymentType": "Mobile",
"senderAddress": {
"name1": "Name1",
"name2": "Name2",
"address1": "Address1",
"address2": "Address2",
"address3": "Address3",
"postalCode": "12345",
"city": "Lund",
"state": "",
"countryCode": "SE",
"doorCode": null
},
"senderEmail": "peter@extend.se",
"senderPhoneNumber": "04612345",
"senderFax": "0461234567",
"invoiceAddress": {
"name1": "ho ho",
"name2": null,
"address1": "ho",
"address2": "ho",
"address3": "",
"postalCode": "12345",
"city": "ho",
"state": "",
"countryCode": "SE",
"doorCode": null
},
"creditInvoiceAction": "WhenReceived"
}
}
Create return order from a customer order with specified rows
{
"createAction": {
"action": "ReturnRowsFromCustomerOrder",
"orderNumber": "OC-142",
"orderRows":[
{
"position" : 10,
"subPosition" : 0
},
{
"position" : 30,
"subPosition" : 0
}
],
"returnCode": "B"
}
}
Create return order from a customer order with specified rows. Returning part of row, ie quantity 2 of 12
{
"createAction": {
"action": "ReturnRowsFromCustomerOrder",
"orderNumber": "OC-142",
"orderRows":[
{
"position" : 10,
"subPosition" : 0,
"quantity" : 2
}
],
"returnCode": "B"
}
}
Create return order without a customer order, from specified products
{
"createAction": {
"action": "ReturnProducts"
},
"header": {
"warehouse": "LOGMULL",
"customerNumber": "3",
"deliveryMethod": "CONS_112",
"paymentType": "Mobile",
"creditInvoiceAction": "WhenReceived"
}
,
"rows": [
{
"returnCode": "A",
"productNumber": "8010",
"salesData": {
"quantity": 2,
"unit": "ST",
"unitPrice": 2.4817,
"vatPercent": 25,
"currency": "SEK"
}
}
]
}
Create return order without a customer order, from specified products. Overriding customers address.
{
"createAction": {
"action": "ReturnProducts",
"returnCode": "B"
},
"header": {
"warehouse": "LOGMULL",
"customerNumber": "3",
"deliveryMethod": "CONS_112",
"paymentType": "Mobile",
"senderAddress": {
"name1": "Name1",
"name2": "Name2",
"address1": "Address1",
"address2": "Address2",
"address3": "Address3",
"postalCode": "12345",
"city": "Lund",
"state": "",
"countryCode": "SE",
"doorCode": null
},
"senderEmail": "peter@extend.se",
"senderPhoneNumber": "04612345",
"senderFax": "0461234567",
"invoiceAddress": {
"name1": "ho ho",
"name2": null,
"address1": "ho",
"address2": "ho",
"address3": "",
"postalCode": "12345",
"city": "ho",
"state": "",
"countryCode": "SE",
"doorCode": null
},
"creditInvoiceAction": "WhenReceived"
}
,
"rows": [
{
"returnCode": "A",
"productNumber": "8010",
"salesData": {
"quantity": 2,
"unit": "ST",
"unitPrice": 2.4817,
"vatPercent": 25,
"currency": "SEK"
}
}
]
}
Related articles