Get returns via the API

Hello,

I need to get all returns via the API. In the GQL docs, you can filter orders by return status. Filtering by any of those values returns 0 results. I know there are orders with returns though. I then tried to filter with the OrderReturnStatus enum and finally get the expected results, but I see this warning as well

"search": [
            {
                "path": [
                    "orders"
                ],
                "query": "return_status:RETURNED",
                "parsed": {
                    "field": "return_status",
                    "match_all": "RETURNED"
                },
                "warnings": [
                    {
                        "field": "return_status",
                        "message": "Input `RETURNED` is not an accepted value."
                    }
                ]
            }
        ]

What is the correct approach here? I would be happy to use the REST API, but the orders response doesn’t include return data, in particular, the id of a return.

The ideal solution would be to have a list returns endpoint, but I don’t see that available.

Any help is greatly appreciated!

Are you trying to filter the valid values?

It seems like you used RETURNED which is not one of the listed valid values. I am also unsure if the values are case sensitive.

I have tried filtering with the “valid” values, but they do not return any results. That’s when I tried to use the other values here: OrderReturnStatus enum. I do in fact get results when I use those “invalid” values, but the response also includes the warning that I added above.

That’s why I am trying to understand what the correct approach is. It appears the API is responding to the invalid values with the expected results, despite the error message.