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 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.
Retrieving Order Reports
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:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <orderReport xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://api.spreadshirt.net" id="123" href="http://api.spreadshirt.net/api/v1/orderReports/123"> <orderItemModifications> <orderItemModification> <order id="123" xlink:href="http://api.spreadshirt.net/api/v1/orders/123"/> <orderItem id="456"/> <correlation> <partner> <orderItemId>extshop-0000000001</orderItemId> </partner> </correlation> <fulfillmentState>RECEIVED</fulfillmentState> <modified>2011-08-03 08:14:00Z</modified> <!-- we use UTC as timezone --> </orderItemModification> <orderItemModification> <order id="123" xlink:href="http://api.spreadshirt.net/api/v1/orders/123"/> <orderItem id="456"/> <correlation> <partner> <orderItemId>extshop-0000000001</orderItemId> </partner> </correlation> <fulfillmentState>CREATED</fulfillmentState> <modified>2011-08-03 08:15:00Z</modified> <!-- we use UTC as timezone --> </orderItemModification> <orderItemModification> <order id="123" xlink:href="http://api.spreadshirt.net/api/v1/orders/123"/> <orderItem id="456"/> <correlation> <partner> <orderItemId>extshop-0000000001</orderItemId> </partner> </correlation> <fulfillmentState>ACCEPTED</fulfillmentState> <modified>2011-08-03 08:30:00Z</modified> <!-- we use UTC as timezone --> </orderItemModification> <orderItemModification> <order id="123" xlink:href="http://api.spreadshirt.net/api/v1/orders/123"/> <orderItem id="456"/> <correlation> <partner> <orderItemId>extshop-0000000001</orderItemId> </partner> </correlation> <fulfillmentState>IN_PROGRESS</fulfillmentState> <modified>2011-08-03 12:00:00Z</modified> <!-- we use UTC as timezone --> </orderItemModification> <orderItemModification> <order id="123" xlink:href="http://api.spreadshirt.net/api/v1/orders/123"/> <orderItem id="456"/> <correlation> <partner> <orderItemId>extshop-0000000001</orderItemId> </partner> </correlation> <fulfillmentState>SHIPPED</fulfillmentState> <modified>2011-08-03 17:00:00Z</modified> <!-- we use UTC as timezone --> </orderItemModification> </orderItemModifications> <state>ACTIVATED</state> <created>2011-08-20 20:00:00</created> <modified>2011-08-20 20:00:00</modified> </orderReport>
Deleting Order Reports
In order, to make the processing of order reports easier, it is possible to delete an order report, i.e. mark a order report as read. An order report can be deleted by conducting a HTTP DELETE on an order report resource, such as http://api.spreadshirt.net/api/v1/orderReports/123.