Right API to search by title

Andrew_Smith5
Shopify Partner
11 0 2

As per this thread https://community.shopify.com/c/Shopify-APIs-SDKs/Right-API-to-search-products-by-title/m-p/989241#M...

 

Using the new pagination method on the /admin/api/2020-10/products.json?title=WORD does not return any results (it returns a 200 response with an empty array, so I know authentication is working, similarly if I remove the title=WORD parameter then products are returned so I know that's working too).

I've started a new thread as the last one was marked Soved so I don't think people will read it.

If I try /admin/products.json?title=WORD then everything works, but this doesn't have the paginated results so I don't want to build an API against it as it'll be removed soon.

I feel like I'm missing something obvious. Any suggestions?

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 188

Hey @Andrew_Smith5,

The behaviour should be the same regardless of API version. Can you kindly share the X-Request-ID value from the response headers of one of your calls that's returning an empty array? I'll use this to check our logs for more information about why the response is empty for you.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

0 Likes
Andrew_Smith5
Shopify Partner
11 0 2

Sure, thanks for the response:

 

Not working: https://DOMAIN.myshopify.com/admin/api/2020-10/products.json?title=WORD

 

7999e5d2-8425-4071-98ea-5a2c0e67f59d

 

Working: https://DOMAIN.myshopify.com/admin/products.json?title=WORD

421135da-fcd7-4dca-8e2a-56b90d794132

Thanks.

0 Likes
Andrew_Smith5
Shopify Partner
11 0 2

Hi @_JB 

 

Do you have an update on this? Sorry to push you, but the plussupport email has told me the only support I can get it on this forum and this is holding up my work now.


Thanks.

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 237

Testing it out here I had the same outcome. The URI that doesn't specify the API version returned products based on the title query parameter, while the URI that specified the 2020-10 API version returned no records. Screen shots below. The "good" request ID is 855d258c-f79f-4703-8d7c-74c91c0fcc46, while the "bad" request ID is "6b4dc7f2-2542-4bd3-91aa-d56c89e94f56". @_JB any chance you can take a peek at these?

good.pngbad.png

0 Likes
Andrew_Smith5
Shopify Partner
11 0 2

Thank you @Greg_Kujawa  for confirming my findings.

@_JBdo you have any news for us?

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 188

Hi All,

We're investigating now. I'll be back in touch soon with an update.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

0 Likes
Andrew_Smith5
Shopify Partner
11 0 2

Hi @_JB 

Have you had any luck with this? I really need to get this resolved.

 

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 237

Hard telling, but one thing I _do_ know is that the GraphQL API will allow freetext searching for products by title. And testing it out I found that it is consistent regardless of the API version that's being hit.

Example below.

1.png

 

UPDATE: Well although the GQL queries by title are consistent across API versions it doesn't necessarily mean they are reliable. In my example about I am querying for any products with chain in the title. In my test shop there are two products with only chain in the title. They didn't appear in the response set. 

So I tried this GQL request.

{
  products(first: 10, query: "title:*chain* OR title:chain") {
    edges {
      node {
        id
        title
      }
    }
  }
}

 

Unfortunately the two products with only chain in the title still didn't appear. *sigh* 

0 Likes
Andrew_Smith5
Shopify Partner
11 0 2

@_JB 

I've tried this with the latest API version 2021-01 and get the exact same behaviour.

Can I please get an update on this?

0 Likes