REST admin API gift_card search all ones that disabled_at is NULL

REST admin API gift_card search all ones that disabled_at is NULL

m_quinteiro
Shopify Partner
6 0 0

I'm using the api the api https://{shop}.myshopify.com/admin/api/2022-10/gift_cards/search.json?

 

And I can do this query

https://luminus-lab.myshopify.com/admin/api/2022-10/gift_cards/search.json?query=disabled_at:IS NOT NULL  

or other queries like 

disabled_at:>2022-01-01 or disabled_at:=2022...

 

but I'm not able to get the ones that have disabled_at unset or = NULL I have tried thinks like

query=disable_at:IS NULL or  query=disable_at:NULL or query=disable_at:=NULL  query=disable_at:=nill, UNDEFINED, UNSET .... and many more.

 

No way...

How I have to do the query to get all the gift cards that are enabled?

 

 

 

Replies 2 (2)

ShopifyDevSup
Shopify Staff
1453 238 509

Hey @m_quinteiro,

Using the Gift Card API docs, and testing using the example request for all enabled cards we were able to return the results you were looking for. Our REST API docs have an updated list of all available filter parameters for a given resource, in this case status.

Example request url:  https://{shop}.myshopify.com/admin/api/2022-10/gift_cards.json?status=enabled&limit=10

Cheers!
 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

m_quinteiro
Shopify Partner
6 0 0

Hi @ShopifyDevSup 

 

I need to add some search criterias, so the answer is not valid for me, but I have tested adding the parameter status=enabled to the search.json endpoint and it works!

 

That parameter is not documented in the searches for gift cards  , for example, this query works perfectly well:

https://luminus-lab.myshopify.com/admin/api/2022-10/gift_cards/search.json?query=status:enabled AND email:******@****.com

and this one too:

https://luminus-lab.myshopify.com/admin/api/2022-10/gift_cards/search.json?status=enabled &query=email:******@****.com