first_order_date queried REST API request of Customer endpoint yields incorrect response

Solved
ftbt900
New Member
2 1 1

Hi,

I'm having trouble getting correct results from the customer endpoint when trying to use the first_order_date query in the get request.  The docs show this as a supported query.  My request looks like this:

GET /customers/search.json?query=first_order_date:2021-06-15

The response is too many customers.  While most of the customers in the response have a first order date of 6/15, some are coming through (as I manually check them in platform) with a first order date of 6/14.  Seems as though the filter is working but i can't seem to get it to be correct with any one particular date.  Is this the correct date format?  Same as created_at_min for orders endpoint?  I tried passing a timezone as well: 

GET /customers/search.json?query=first_order_date:2021-06-15 07:00

with no success (it returns the same results as the first request)

Has anyone else ran into this issue?

Thanks in advance,

Ryan

0 Likes
awwdam
Shopify Staff
Shopify Staff
92 9 4

Hey @ftbt900,

Great question here! Just wanted to confirm if you have you tried adjusting the data/time format use in the filter query to match the docs? For example, there is reference to the linked resource on ISO 8601 format, and might suggest starting from the time used to filter 2021-06-15 00:07:00 and adding a -/+(UTC Offset) for the shop in question, to match other examples given like this: 2014-04-25T16:15:47-04:00, - Cheers!

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
ftbt900
New Member
2 1 1

This is an accepted solution.

Thanks for the response.  I did try date/time format according to the docs.

For anyone else looking, I was able to get this working by using the following syntax, without any tz info passed:

GET /customers/search.json?query=first_order_date:>2021-06-15 first_order_date:<2021-06-15

I'd love to know if this format is something I can rely on since it doesn't exist in the REST documentation.  Thanks!