REST API - Order resource

Introduction

In this part of the documentation, you can learn more about the API's orders resource. With this resource, it is possible to retrieve and update any order in your shop. We will also have a look at the associated data structures.

General Information

This resource supports the following operations:

Access URL GET GET (List) PUT PUT (Batch) POST DELETE DELETE (Batch)
/api/orders Yes Yes Yes No Yes No No

If you want to access this resource, simply query the following URL:

  • http://my-shop-url/api/orders

GET

Required Parameters

This API call requires one of the following parameters to be defined:

Identifier Parameter DB column Example call
Order Id id s_order.id /api/orders/2
Order number number s_order.number /api/orders/20003?useNumberAsId=true
  • useNumberAsId=true - This tells the API to query the order's data by its number, instead of its actual identifier. Otherwise, the syntax is just /api/orders/id. It's not possible to provide both parameter at the same time.

Return Value

Model Table
Shopware\Models\Order\Order s_order
Field Type Original Object
id integer (primary key)
number string
customerId integer (foreign key) Customer
paymentId integer (foreign key) PaymentData
dispatchId integer (foreign key) Dispatch
partnerId integer (foreign key)
shopId integer (foreign key) Shop
invoiceAmount double
invoiceAmountNet double
invoiceShipping double
invoiceShippingNet double
invoiceShippingTaxRate double
orderTime date/time
transactionId string
comment string
customerComment string
internalComment string
net boolean
taxFree boolean
temporaryId string
referer string
clearedDate date/time
trackingCode string
languageIso integer (foreign key) Locale
currency string
currencyFactor double
remoteAddress string
deviceType string
details array Detail
documents array Document
payment object Payment
paymentStatus object PaymentStatus
orderStatus object OrderStatus
customer object Customer
paymentInstances array PaymentInstance
billing object Billing
shipping object Shipping
shop object Shop
dispatch object Dispatch
attribute object Attribute
languageSubShop object Shop
paymentStatusId integer (foreign key) Status
orderStatusId integer (foreign key) OrderStatus

GET (List)

For this operation, no parameters are required. To get a list of all orders, simply query: * http://my-shop-url/api/orders

Model Table
Shopware\Models\Order\Order s_order
Field Type Original Object
id integer (primary key)
number string
customerId integer (foreign key) Customer
paymentId integer (foreign key) PaymentData
dispatchId integer (foreign key) Dispatch
partnerId integer (foreign key)
shopId integer (foreign key) Shop
invoiceAmount double
invoiceAmountNet double
invoiceShipping double
invoiceShippingNet double
orderTime date/time
transactionId string
comment string
customerComment string
internalComment string
net boolean
taxFree boolean
temporaryId string
referer string
clearedDate date/time
trackingCode string
languageIso integer (foreign key) Locale
currency string
currencyFactor double
remoteAddress string
deviceType string
attribute object
customer object Customer
paymentStatusId integer (foreign key) Status
orderStatusId integer (foreign key) OrderStatus

PUT (update)

Orders can be identified using the following:

Identifier Parameter DB column Example call
Order Id id s_order.id /api/orders/2
Order Number number s_order.number /api/orders/20003?useNumberAsId=true

The data structure used is similar to the one returned in the GET request.

POST (create)

Please be aware: When an order is created using the API, no calculations for tax, shipping cost, etc. are done. Also no checks regarding validity of the provided values will be executed.

Creation of orders via REST-API is available since Shopware 5.2.21.

Orders can be created using the following fields:

Field Type Original Object / Database table
customerId (required) integer (foreign key) Customer
paymentId (required) integer (foreign key) PaymentData
dispatchId (required) integer (foreign key) Dispatch
paymentStatusId (required) integer (foreign key) Status
orderStatusId (required) integer (foreign key) OrderStatus
shopId (required) integer (foreign key) Shop
invoiceAmount (required) double
invoiceAmountNet (required) double
invoiceShipping (required) double
invoiceShippingNet (required) double
partnerId string
orderTime date/time
net (required) integer
taxFree (required) integer
languageIso integer
currency string
currencyFactor(required) double
remoteAddress (required) string
details (required) array Detail
documents array
billing (required) object Billing
shipping (required) object Shipping
Top