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

Solved
ChristianLopez
Shopify Partner
8 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 ? 

Accepted Solutions (2)
ChristianLopez
Shopify Partner
8 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.

 

 

View solution in original post

Impress
Shopify Partner
20 1 6

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
      }
    }
  }
}

View solution in original post

Replies 8 (8)
ChristianLopez
Shopify Partner
8 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.

 

 

Impress
Shopify Partner
20 1 6

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
      }
    }
  }
}
souravchandra
Tourist
19 0 1

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

Impress
Shopify Partner
20 1 6
Hmm, only thing I can think of is that it might be an API versioning issue? Otherwise might want to report it to Shopify!
souravchandra
Tourist
19 0 1

Hi,

 

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

 

Thanks,

Sourav

 

HunkyBill
Shopify Expert
4837 60 587

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
souravchandra
Tourist
19 0 1

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*' 

HunkyBill
Shopify Expert
4837 60 587

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