Latest placed orders from customers with specific email domains
How to use the Metrics API to get the last placed orders containing specific email domains in the aggregated details
The problem
You want to get the last ten placed orders that contain two specific email domain in the aggregated details full text, over a selected date and time range, chronologically ordered by date of placement.
The solution
Query
You need to perform a search query setting the required query keys as follows and adding the optional ones based on your needs:
limit
10
sort_by
order.placed_at
If you want to focus on some specific information about the carts you're searching for, just fill in the fields
array with the list of attributes you want to get in the response.
Filter
Set the desired date and time range using the date_from
and date_to
keys and add an additional filter on the order field to restrict the related search on orders whose aggregated details matches the query:
aggregated_details
"query": "(*@gmail.com | *@hotmail.com) + placed"
As shown in the example below, use placed_at
as the date_field
in the date filter if you want the results to count all the orders that were placed in the selected date and time range (read more about this).
Example
The following request uses the Metrics API to search a specific query within the aggregated details of an ordert:
Similar cases
Just changing a couple of query keys and/or filter parameters you can address lots of very similar use cases, such as:
Last updated