REST API filtering doesn't work

Hello everyone,

I’m working on a custom order management system running on my own server, and I’m trying to retrieve orders via the REST API. I’m filtering the ‘fulfillmentStatus’ field for ‘NOT_FULFILLED’, but the system still returns all orders to me, so it seems that the filtering doesn’t work.

The endpoint I’m using is https://www.wixapis.com/ecom/v1/orders/query
And the query I’m POSTing is:
{ "filter": { "fulfillmentStatus": "NOT_FULFILLED" } }

I have tried all the variants of this I can think of such as wrapping it in a search:

{ "search": { "filter": { "fulfillmentStatus": "NOT_FULFILLED" } } }

And

{
"search": {
"filter": {
"fulfillmentStatus": "FULFILLED"
},
"sort": [
{
"fieldName": "number",
"order": "DESC"
}
],
"cursorPaging": {
"limit": 20
}
}
}

As well as using comparison modifiers:

{ "filter": { "fulfillmentStatus": { "$eq": "NOT_FULFILLED" } } }

And any combination of these I can think of. I’ve gone through the documentation and just can’t find anything that helps me get just the filtered orders. I’ve also tried searching and filtering other fields, but still it returns everything.

Can anyone help me?

Thank you for your time.

Best regards,
Peter Heldal

You might want to double-check if the filter key is case-sensitive. Sometimes the REST API requires “fulfillmentStatus”: “NOT_FULFILLED” to be wrapped properly inside “query”: { “filter”: { … } }. Also, make sure your endpoint supports filtering — a few Wix APIs ignore filters unless pagination is defined.

1 Like

Wrapping it in “query” and adding “paging” seemed to work! I wasn’t able to find anything about wrapping it in “query” in the documentation, so I’m really glad you pointed it out!!

Thank you so much for your help! :smiley:

2 Likes

Glad it helped! :slightly_smiling_face:
Wix docs sometimes miss small implementation details, so testing with “query” and pagination is usually the quickest way to confirm.
If you run into any other API issues, just share the snippet. Happy to take a look.