In my last blog post in the series “API Terminology Explained”, I introduced the order model.
In this blog post, I will continue with the order report model. Understanding the order report model together with the order model allows you to trigger actions on the partner-side based on order item state transitions and to implement a working order API client.
Understanding the Order Report Model
In our terminology, an order report contains a list of all fulfillment state modifications on order items from time x to time y that belong to a specific partner. Thus, the fulfillment state change information from the order report together with the fulfillment states and the state transitions explained for the order resources in our developer wiki can be used to trigger actions based on fulfillment state transitions on the partner-side, such as sending a shipping confirmation e-mail to the partner’s customer. An order report has right now the following characteristics:
- Core Data: Each order report has a state, i.e. ACTIVATED or DELETED, and a created and modified date.
- Order Item Modifications: Each order report contains a list of order item modifications. An order item modification denotes the modification of the fulfillment state of an order’s order item. It therefore contains a link to the actual order and order item. It also contains the new fulfillment state, e.g. CREATED, ACCEPTED or SHIPPED, and a modified date.
- Correlation: In case the partner provided correlation information on order creation, the order item modifications will contain the same correlation information. They allow the partner to easily connect the fulfillment state modifications on the order items on the Spreadshirt platform with order items of his e-commerce or ERP system.
The order reports generated for a partner, such as partner 1102730, can in general be received by conducting a HTTP GET call on the order reports resource http://api.spreadshirt.net/api/v1/orderReports?query=+partnerId:(1102730) +state:(ACTIVATED). A single order report can be fetched, by conducting a HTTP GET call on an order report resource, such as http://api.spreadshirt.net/api/v1/orderReports/123. The order report resources are described in detail in our developer wiki. A sample order report XML would look as follows: