You can use the WebSphere Commerce REST API to export order data of a specific store. The
output is exported in CSV format.
Before you begin
Ensure that the Swagger UI and the REST Discovery API are enabled. For more information, see
Enabling and disabling the REST Discovery API.Note: By default, for
each store, only 1 order export is allowed per user (with the appropriate access control role) per
hour. To change the minimum time between exports, see
Procedure
-
Use the Organization Administration Console to assign the following roles to a WebSphere
Commerce user:
- Assign the Registered Customer role to the user. This role allows users
to log in to the store and access the order export tools in the Swagger UI. This role is necessary
if the user password is expired and must be reset by using the storefront.
- Assign any of the following roles to provide access to export and download order data:
- Operations Manager
- Buyer ( sell side)
- Category Manager
- Marketing Manager
- Operations Manager
- Logistics Manager
- Sales Manager
- Product Manager
- Seller
- Site Administrator
-
Go to the Aurora starter store and log in to the store with a user account that has access to
export orders. You need to log in to use the order export REST services that are in the Swagger
UI.
-
Open a web browser and go to the following URL to access the Swagger UI:
https://hostname/webapp/wcs/stores/servlet/swagger/index.htmlIn
the Swagger UI, the order_export class is used to export order data. Then, the
order_download class is used to download the exported order data.
-
Export the order data.
-
Expand the order_export class.
-
Expand the POST /store/{storeId}/order_export/ method path.
-
Enter the necessary parameters.
Parameter |
Value |
storeId Note: storeId is a mandatory parameter. |
The store identifier. |
body Note: Specify optional parameters in JSON format. |
There are two values that you can submit.
- status
- Only export orders with the specified status. Valid values are based on the STATUS column of the
ORDERS database table.
If status is not specified, then the
following default values are
used "A","B","C","D","F","G","H","I","M","R","S","W"
Note: The default list
assumes that Sterling Order Management is used. Therefore, if your environment is not integrated
with Sterling Order Management, then you might notice that the list contains more STATUS values than
your ORDERS table.
- timePlacedInDays
- Export orders that were placed x days since the current time. For example,
0 represents all orders that were placed since 12:00am today.
1 represents all orders since 12:00am yesterday.
If
timePlacedInDays is not specified, then 0 is used by
default.
For example, the following parameters exports orders that were placed within the last 100
days and have a status of 'M', 'A', or
'B'.{
"status":"M,A,B",
"timePlacedInDays":"100"
}
|
-
Click Try it out!
Note: The order export is stored in the UPLOADFILE database table.
-
Note the
exportId
in the response body. The exportId
is used
to download the order data in the proceeding step.
-
Download the exported order data.
-
Expand the order_download class.
-
Expand the GET /store/{storeId}/order_download/byExportId/ method
path.
-
Enter the storeId that you previously used, and the exportId from step 4.e.
-
Click Try it out!
-
The response body contains the exported order data in CSV format.
-
Download the CSV file by going to the response request URL in your web browser.
For example, for a store with storeId 10151 and exportId 10001, the request response URL is
https://localhost:443/wcs/resources/store/10151/order_download/byExportId/10001