XM
Powered By GitBook
Order Query
Path:
1
POST https://{baseurl}/api-order/orders/query
Copied!
This API is primarily used to build/create the Orders listing page to display orders in a paginated response based on the filter criteria in the request body.

Headers

Content-Type : application/json
x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }
x-api-key : d41d8cd98f00b204e9800998ecf8427e

Parameters

Type: body
Name: The pagination and order filtering criteria.
Required: true

Sample Request

Path:
1
POST https://{baseurl}/api-order/orders/query
Copied!
1
{
2
"offset": 0,
3
"limit": 2,
4
"sortBy": "createdAt",
5
"sortDirection": "asc",
6
"filters": {
7
"date": {
8
"gte": "2020-05-03T00:00:00.000Z",
9
"lte": "2020-12-03T23:59:59.999Z"
10
},
11
"status": ["ORDER_CREATED", "ORDER_CONFIRMED", "ORDER_CANCELLED", "ORDER_PARTIALLY_SHIPPED", "ORDER_SHIPPED", "ORDER_PARTIALLY_DELIVERED", "ORDER_DELIVERED", "ORDER_RETURNED", "ORDER_PARTIALLY_RETURNED", "ORDER_PAYMENT_AUTHORIZED", "ORDER_PAYMENT_INVALID"]
12
13
}
14
}
Copied!

Response

Response Code: 200
Message: OK
Description: You will see this message when the order is successfully retrieved based on the specified criteria.
1
{
2
"query": {
3
"limit": 2,
4
"offset": 0,
5
"count": 11057,
6
"orderTotalSum": 7798910.03,
7
"orderAverage": 705.34,
8
"totalQuantitySum": 35334,
9
"statusCounts": {
10
"ORDER_CREATED": 304,
11
"ORDER_CONFIRMED": 0,
12
"ORDER_CANCELLED": 0,
13
"ORDER_PARTIALLY_SHIPPED": 263,
14
"ORDER_SHIPPED": 960,
15
"ORDER_PARTIALLY_DELIVERED": 0,
16
"ORDER_DELIVERED": 0,
17
"ORDER_RETURNED": 0,
18
"ORDER_PARTIALLY_RETURNED": 0,
19
"ORDER_PAYMENT_AUTHORIZED": 7981,
20
"ORDER_PAYMENT_INVALID": 1549
21
}
22
},
23
"orders": [
24
{
25
"_id": "5ee8ca841e926a0008de19db",
26
"tags": [],
27
"cartId": "5ee8ca2071209a0007897b43",
28
"customerEmail": "[email protected]",
29
"customerPhone": {
30
"number": "9179758841",
31
"kind": "Mobile"
32
},
33
"orderCurrency": "USD",
34
"orderTotal": 31.26,
35
"taxTotal": 2.32,
36
"channel": 12,
37
"status": "ORDER_PAYMENT_AUTHORIZED",
38
"statusLog": "Order has been placed",
39
"orderId": "6069-8919-73523",
40
"shipTo": [
41
{
42
"address": {
43
"name": {
44
"first": "Alex",
45
"last": "Weininger"
46
},
47
"phone": {
48
"number": "9179758841",
49
"kind": "mobile"
50
},
51
"email": "[email protected]",
52
"street1": "125 Millbrook Rd",
53
"street2": "general delivery",
54
"city": "Claverack",
55
"state": "NY",
56
"country": "US",
57
"zipCode": "12513-9999",
58
"kind": "shipping"
59
},
60
"promosApplied": [],
61
"_id": "5ee8ca55a5005e0008ab0c40",
62
"shipToType": "SHIP_TO_ADDRESS",
63
"taxCode": "FR020000",
64
"shipToId": 396,
65
"price": 10.94,
66
"currency": "USD",
67
"shipmentMethodId": "5d8cbfd3164e448ba1d12f7501141027",
68
"estimatedTax": 0.88,
69
"shipmentCarrier": "FedEx",
70
"shipmentMethod": "Ground®",
71
"total": 11.82,
72
"id": "5ee8ca55a5005e0008ab0c40"
73
}
74
],
75
"items": [
76
{
77
"group": [
78
"5e2cf73f45570b000863c48b"
79
],
80
"promosApplied": [],
81
"_id": "5ee8ca2071209a0007897b44",
82
"price": 18,
83
"weightUnit": "lb",
84
"itemId": 1000002892,
85
"quantity": 1,
86
"sku": "1561664",
87
"taxCode": "PE090100",
88
"title": "Bud Vase Dark Blue",
89
"weight": 0.5,
90
"lineItemId": 1,
91
"currency": "USD",
92
"shipToId": 396,
93
"discount": 0,
94
"estimatedTax": 1.44,
95
"total": 19.44,
96
"id": "5ee8ca2071209a0007897b44"
97
}
98
],
99
"shipments": [],
100
"revision": 1,
101
"totalQuantity": 1,
102
"events": [],
103
"createdAt": "2020-06-16T13:35:00.637Z",
104
"updatedAt": "2020-06-16T13:35:03.836Z",
105
"__v": 0
106
},
107
{
108
"_id": "5ee8cb191e926a0008de19e3",
109
"tags": [],
110
"cartId": "5ee8bdfe71209a0007897ad7",
111
"customerUserId": "5ec8155d2c1cb500076e2d02",
112
"customerEmail": "[email protected]",
113
"customerPhone": {
114
"number": "9179758841",
115
"kind": "Mobile"
116
},
117
"orderCurrency": "USD",
118
"orderTotal": 31.26,
119
"taxTotal": 2.32,
120
"channel": 12,
121
"status": "ORDER_PAYMENT_AUTHORIZED",
122
"statusLog": "Order has been placed",
123
"orderId": "2216-3946-51595",
124
"shipTo": [
125
{
126
"address": {
127
"name": {
128
"first": "alex",
129
"last": "weininger"
130
},
131
"phone": {
132
"number": "9179758841",
133
"kind": "mobile"
134
},
135
"email": "[email protected]",
136
"street1": "125 Millbrook Rd",
137
"street2": "general delivery",
138
"city": "Claverack",
139
"state": "NY",
140
"country": "US",
141
"zipCode": "12513-9999",
142
"kind": "shipping"
143
},
144
"promosApplied": [],
145
"_id": "5ee8caf3a5005e0008ab0c42",
146
"shipToType": "SHIP_TO_ADDRESS",
147
"taxCode": "FR020000",
148
"shipToId": 398,
149
"price": 10.94,
150
"currency": "USD",
151
"shipmentMethodId": "fd618d13fa44413393f6a565d7a61edb",
152
"estimatedTax": 0.88,
153
"shipmentCarrier": "FedEx",
154
"shipmentMethod": "Ground®",
155
"total": 11.82,
156
"id": "5ee8caf3a5005e0008ab0c42"
157
}
158
],
159
"items": [
160
{
161
"group": [
162
"5e2cf73f45570b000863c48b"
163
],
164
"promosApplied": [],
165
"_id": "5ee8bdfe71209a0007897ad8",
166
"price": 18,
167
"weightUnit": "lb",
168
"itemId": 1000002892,
169
"quantity": 1,
170
"sku": "1561664",
171
"taxCode": "PE090100",
172
"title": "Bud Vase Dark Blue",
173
"weight": 0.5,
174
"lineItemId": 1,
175
"currency": "USD",
176
"shipToId": 398,
177
"discount": 0,
178
"estimatedTax": 1.44,
179
"total": 19.44,
180
"id": "5ee8bdfe71209a0007897ad8"
181
}
182
],
183
"shipments": [],
184
"revision": 1,
185
"totalQuantity": 1,
186
"events": [],
187
"createdAt": "2020-06-16T13:37:29.646Z",
188
"updatedAt": "2020-06-16T13:37:30.835Z",
189
"__v": 0
190
}
191
]
192
}
Copied!
Error Code: 400
Message: Bad Request
Description: You will see this error when the status provided is an invalid status.
1
{
2
"code": "REQUEST_VALIDATION",
3
"message": "Invalid data in body: /filters/status/0 should be equal to one of the allowed values"
4
}
Copied!
Error Code: 500
Message: Internal Server Error
Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

    June - 2021
    July - 2020 First updated
Last modified 2mo ago
Copy link
Contents
Change Log