Rest API multiple values in a filter

Solved
Shopify Partner
148 0 7

We would like to query the orders.json endpoint for financial_status of both paid and partially_refunded.

Is it possible to do this in a single API call?

I tried comma separating them but that doesn’t seem to be valid.

e-commerce order fulfillment made fast. simple. easy. www.fulfillrite.com
0 Likes
Highlighted

Success.

Shopify Partner
1843 170 525

Hello!

 

Not aware of that being possible using REST Admin API because I haven't found a way to employ the regular query search syntax on REST endpoints. It's also not possible to have an Orders saved search as is with Customers (at least not that I am aware of).

 

So much for the bad news. Good news is you can do that using GraphQL Admin API e.g.

 

{
  orders(first:250, query:"financial_status:paid OR financial_status:partially_refunded") {
    edges {
      node {
        id
        displayFinancialStatus
      }
    }
  }
}

Beware to use lowercase (even though displayFinancialStatus is uppercase) in the query and do not use field names as defined in the GraphQL reference, but field names as defined from REST reference.

 

Hope this helps!

I turn coffee in to code - since 1998
1 Like
Shopify Partner
148 0 7

Hi Karl,

Thanks for the info!

I was afraid that GraphQL would be the only way to accomplish this :)

 

We're sticking with REST for now, so looks like the only options for us are 

  1. Make two separate API calls
  2. Don't pass in financial_status and filter on the client
e-commerce order fulfillment made fast. simple. easy. www.fulfillrite.com
0 Likes
Excursionist
92 0 2

Hello there,

I can help you on this issue. Please mail me at atique@99coders.co

Waiting for your mail,

Thanks 

Atique/99coders

Best Regards,
Shopify Expert
Atique/99coders
Email: atique@99coders.co
Skype: info@99coders.co
0 Likes