API issue, can't fetch products filtering by their title

Solved
Highlighted
Tourist
7 1 0

Hi guys ! I'm trying to migrate to the new api, but I can't fetch products filtering by their title

 

API 2019-04 (Works fine, has results 🍻)

Url: https://{{api_key}}:{{api_password}}@{{store_name}}.myshopify.com/admin/api/2019-04/products.json?title=value

Results :

{
    "products": [
        {..},
        {..},
        {..},
        {..},
        {..},
        {..},
    ]
}

 

API 2019-07 (No results 🥺)

Url: https://{{api_key}}:{{api_password}}@{{store_name}}.myshopify.com/admin/api/2019-07/products.json?title=value

Results :

{
    "products": []
}

 

The docs : https://help.shopify.com/en/api/reference/products/product?api[version]=2019-07

In the docs title is supported ¿Any ideas ? 

0 Likes
Highlighted
Tourist
7 1 0

This is an accepted solution.

Hi ! I founded my "problem" here https://help.shopify.com/en/api/versioning/release-notes/2019-07

Searching by partial title is not supported now, the 2019-07 changelog:

 

Requests that pass a value for title will match only if the value is the same as the complete title. Partial matches aren't supported.

 

 

0 Likes
Highlighted
Shopify Partner
17 1 3

This is an accepted solution.

Partial matching has moved to the GraphQL endpoint. To match all products containing "partial", you'd provide the query:

*partial*

 

For example:

{
  products(first: 10, query: "title:*partial*") {
    edges {
      node {
        id
        title
      }
    }
  }
}
Highlighted
Tourist
19 0 0

Hi,

 

I need to search using partial product title. As per your comment I had tried *partial* but it does not seem to work.

 

This is my payload

{
  products(first: 10, query: "title:*av*") {
    pageInfo {
      hasNextPage
      hasPreviousPage
    }
    edges {
      cursor
      node {
        title
        featuredImage {
          transformedSrc
        }
      }
    }
  }
}

Could you help me why it is not returning anything?

 

Thanks,

Sourav

0 Likes
Highlighted
Shopify Partner
17 1 3
Hmm, only thing I can think of is that it might be an API versioning issue? Otherwise might want to report it to Shopify!
0 Likes
Highlighted
Tourist
19 0 0

Hi,

 

Could you please tell me how I can report to Shopify?

 

Thanks,

Sourav

 

0 Likes
Highlighted
Shopify Expert
4265 32 434

There is nothing to report to Shopify here souravchandra. That GraphQL with the query search in the title does in fact work.

 

You might want to use a tool like Insomnia to validate your work. It allows you debug these things with a lot of certainty about where a problem may like. Makes it easy to change API versions, etc.

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Highlighted
Tourist
19 0 0

I tried with Shopify's own GraphiQL app. It works for prefix search queries but not for partial queries. I mean my products are say test1 and test2, it works when I specify 'title:t*' but not for 'title:*es*' 

0 Likes
Highlighted
Shopify Expert
4265 32 434

Oh well. I see ... so use the search endpoint then. It is more for general queries like that. That is what Shopify uses too. It is not perfect, no, far from it, but is more loose and might help you. You will probably hate that too. Searching for such small fragments is not too interesting for the most part.

 


@souravchandra wrote:

I tried with Shopify's own GraphiQL app. It works for prefix search queries but not for partial queries. I mean my products are say test1 and test2, it works when I specify 'title:t*' but not for 'title:*es*' 


 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes