OrderSearch resource (Shop API 23.2)
Summary
Http Method | Resource | Description |
---|---|---|
POST | /order_search | Searches for orders.
The query attribute specifies a complex query that can be used to narrow down the search.
Note that search fields are mandatory now and no default ones are supported.
As the old order search version, the new one always uses Search Service too and the for that reason Order
Incremental Indexing should be enabled. Otherwise HTTP 500 response will occur.
The supported search fields are:
|
Search orders
Searches for orders. The query attribute specifies a complex query that can be used to narrow down the search. Note that search fields are mandatory now and no default ones are supported. As the old order search version, the new one always uses Search Service too and the for that reason Order Incremental Indexing should be enabled. Otherwise HTTP 500 response will occur. The supported search fields are:- affiliate_partner_i_d
- affiliate_partner_name
- business_type
- channel_type
- confirmation_status (String)
- created_by
- creation_date
- last_modified
- currency_code
- customer_email
- customer_name
- customer_no
- export_after
- export_status (String)
- external_order_no
- external_order_status
- global_party_id
- last_modified
- order_no
- original_order_no
- payment_status (String)
- replaced_order_no
- replacement_order_no
- shipping_status (String)
- status (String)
- total_gross_price
- total_net_price
- order.has_holds
- coupon_line_items.coupon_code
- coupon_line_items.coupon_id
- holds.type
- invoices.status
- order_items.status
- payment_instruments.credit_card_type
- payment_instruments.payment_method_id
- product_items.product_id
- return_cases.return_case_number
- shipments.shipping_method_id
- shipping_orders.shipping_order_number
Url
POST https://hostname:port/dw/shop/v23_2/order_search
Formats
json, xml
Authentication
Name | Description |
---|---|
JWT | Authentication via Customer JWT. A valid user is required. |
OAuth | Authentication via OAuth token. |
Request Document
Response Document
Customization
This Resource supports server-side customization.
Extension Point | Method Detail |
---|---|
dw.ocapi.shop.order_search.modifyPOSTResponse |
modifyPOSTResponse (orderSearchResultResponse : OrderSearchResult ) : Status
|
Sample
# Retrieve all properties from search results
REQUEST:
POST /dw/shop/v23_2/order_search HTTP/1.1
Host: example.com
Accept: application/json
{
"query" : {
"text_query": {
"fields": [
"customer_email"
],
"search_phrase":"[email protected]"
}
},
"select" : "(**)",
"sorts" : [{"field":"customer_name", "sort_order":"asc"}]
}
RESPONSE:
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: application/json; charset=UTF-8
{
"_v" : "23.2",
"_type" : "order_search_result",
"count" : 1,
"hits" :
[
{
"_type" : "order_search_hit",
"data" :
{
"_type" : "order",
"adjusted_merchandize_total_tax" : 3.75,
"adjusted_shipping_total_tax" : 0.00,
"billing_address" :
{
"_type" : "order_address",
"city" : "Boston",
"country_code" : "US",
"first_name" : "Jane",
"full_name" : "Jane Doe",
"last_name" : "Doe",
"postal_code" : "29199"
},
"channel_type" : "callcenter",
...
"c_created_by" : "testAgent"
},
"relevance" : 2.822207450866699
}
],
"select" : "(**)",
"start" : 0,
"total" : 1
}
# Retrieve certain child properties from search results
REQUEST:
POST /dw/shop/v23_2/order_search HTTP/1.1
Host: example.com
Accept: application/json
{
"query" : {
"filtered_query": {
"filter": {
"range_filter": {
"field": "creation_date",
"from": "2020-03-08T00:00:00.000Z",
"to": "2020-03-10T00:00:00.000Z"
}
},
"query" : {
"match_all_query": {}
}
}
},
"select" : "(hits.(data.(creation_date,confirmation_status,total)))",
"sorts" : [{"field":"creation_date", "sort_order":"asc"}]
}
RESPONSE:
HTTP/1.1 200 OK
Content-Length: 29
Content-Type: application/json; charset=UTF-8
{
"_v":"23.2",
"_type":"order_search_result",
"hits": [
{
"_type":"order_search_hit",
"data": {
"_type":"order",
"creation_date":"2020-03-08T04:15:00.000Z",
"confirmation_status":"confirmed",
"total":19.95
}
},
{
"_type":"order_search_hit",
"data": {
"_type":"order",
"creation_date":"2020-03-08T07:30:00.000Z",
"confirmation_status":"confirmed",
"total":75.29
}
}
],
"select" : "(hits.(data.(creation_date,confirmation_status,total)))",
"start" : 0,
"total" : 2
}
X
OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.