Rest API - Customers - created_at_min returning DESC

Solved

Rest API - Customers - created_at_min returning DESC

Jon_Chambers
Shopify Partner
29 3 2

Hi.

 

I would expect the result dates to be ASC not DESC.

 

x-request-id: 5abc038a-49d5-4720-bc44-2507827dfb9d-1726550207

 

/admin/api/2024-07/customers.json?limit=3&fields=id,created_at&created_at_min=2019-09-11T12:50:03-07:00

 

Result: 

            [customers] => Array
                (
                    [0] => Array
                        (
                            [id] => 6541824000035
                            [created_at] => 2024-09-11T13:13:27-07:00
                        )

                    [1] => Array
                        (
                            [id] => 6541767147555
                            [created_at] => 2024-09-11T12:52:53-07:00
                        )

                    [2] => Array
                        (
                            [id] => 6541758529571
                            [created_at] => 2024-09-11T12:50:03-07:00
                        )

                )

Notice the created_at is 2024?

There are customers since 2019.

 

Why is it returning the most recent when it specifies min?

Why is there no "order_by" (ASC/DESC).

 

Regards.

 

 

 

Accepted Solution (1)

Jon_Chambers
Shopify Partner
29 3 2

This is an accepted solution.

I figured it out.

 

/admin/api/2024-07/customers.json?limit=3&fields=id,created_at&created_at_min=2019-09-11T12:50:03-07:00&order=created_at+asc

 

You can use "order" with (id, created_at, updated_at, processed_at) (space) "+" and (asc/desc)

 

Hope this helps someone else.

 

 

 

View solution in original post

Reply 1 (1)

Jon_Chambers
Shopify Partner
29 3 2

This is an accepted solution.

I figured it out.

 

/admin/api/2024-07/customers.json?limit=3&fields=id,created_at&created_at_min=2019-09-11T12:50:03-07:00&order=created_at+asc

 

You can use "order" with (id, created_at, updated_at, processed_at) (space) "+" and (asc/desc)

 

Hope this helps someone else.