Skip to content

No Results in GET/V1/orders Request with filters

I’m facing an issue while using the Magento Commerce API. I’m trying to make a GET request to the /V1/orders endpoint with a filter on the created_at field to retrieve orders created after a specific date and time. However, even though I receive totalPage = 3 in the response, the items field is empty.

Here’s my request:

GET /V1/orders?searchCriteria[filterGroups][0][filters][0][field]=created_at&searchCriteria[filterGroups][0][filters][0][value]=2023-11-10 13:08:31&searchCriteria[filterGroups][0][filters][0][conditionType]=gt&searchCriteria[pageSize]=10&searchCriteria[currentPage]=1

Response

{
"items": [],
"search_criteria": {
"filter_groups": [
 {
  "filters": [
    {
      "field": "created_at",
      "value": "2023-11-10 13:08:31",
      "condition_type": "gt"
    }
  ]
 }
],
"sort_orders": [],
"page_size": 0,
"current_page": 0
},
"total_count": 3
}

If I adjust the created_at filter one hour forward like this

GET /V1/orders?searchCriteria[filterGroups][0][filters][0][field]=created_at&searchCriteria[filterGroups][0][filters][0][value]=2023-11-10 13:08:31&searchCriteria[filterGroups][0][filters][0][conditionType]=gt&searchCriteria[pageSize]=10&searchCriteria[currentPage]=1

I receive the following response:

{
"items": [],
"search_criteria": {
"filter_groups": [
 {
  "filters": [
    {
      "field": "created_at",
      "value": "2023-11-10 13:08:31",
      "condition_type": "gt"
    }
  ]
 }
],
"sort_orders": [],
"page_size": 0,
"current_page": 0
},
"total_count": 0
}

I have 3 orders created after 14:08 that don’t seem to be retrieved in both cases, whereas they are retrieved correctly when fetching all orders.

I’m having difficulty comprehending why these three orders are not being retrieved. Is it possible that the date format in the Magento database differs (which I don’t have direct access to), or could the issue be related to my filtering, or is there some other factor at play?