Product Search By Title Using API

Highlighted
Shopify Partner
1 0 0

Hi,

I am looking for searching products based on title.

But I can't  find any search API for products in API section. Have I missed it somewhere or any info regarding this is appreciated.

Thanks !

0 Likes
Highlighted
Shopify Partner
42 0 0

Hi Pulkit,

You should use the /admin/products.json API, fields=id,title, limit=250 and since_id query parameters to fetch all products, and then perform searching on your side. That's the way I've been using so far.

A Shopify agency that helps build, promote, and expand e-commerce businesses.
0 Likes
Highlighted
Shopify Partner
7 0 1

It's a little bit of work to set up, but I used the python api and created a sqlite database that stored all of the product id's and associated sku's so that I could just query the database and look up the product directly by id, given a specific sku:

product = shopify.Product.find(id)

Then I can make changes to the product and save it. You could potentially do the same thing with titles instead of skus.

0 Likes
Highlighted
Shopify Partner
30 0 5

You can search by title using the "title" param on the /admin/products.json API that Shopinet mentioned. As in:

/admin/products.json?title=<searchString>,limit=250,page=1,fields="id,title,etc"

I've found that some very simple matching is done. For example, searching with a title of "blue" will match a product named "blue shirt". But I haven't found a way to insert real wildcards... and the matching from the API isn't as good as the matching demonstrated by Shopify's own admin UI widgets.

So for now I'm using the "title" query param, but planning to pull everything into my own searchable datastore in the near future.

1 Like
Highlighted
Shopify Partner
11 0 11

Hi Burns,

I did an Ajax request inside my Shopify App using this "/admin/products.json?title=<searchString>,limit=250,page=1,fields="id,title,etc" to search product by title ... but i get nailed by CORS.

Is there any way to use Ajax API call inside Shopify App or any alternative solution to Filter/Search data from API ?

Thank you,

0 Likes
Highlighted
Shopify Partner
30 0 5

I don't believe the CORS issue you're seeing is related to the query params used for searching products by title. This sounds like a general issue getting started with the API.

For what it's worth, you need to call the JSON API from your registered application... by which I mean your registered, authenticated server needs to make the call to the Shopify server. Not the browser. (I mention this because you said you're trying to use Ajax.)

0 Likes
Highlighted
Shopify Partner
11 0 11

Thank you Jerard,

Actually I have an Embeded App on Shopify and its run on my private VPS with an SSL certificate ... and I make calls to the Shopify API by a library called ShopifySharp ... every thing work great, But I need to filter & search products by Title! 

Is there any alternative way to do a client side filter & search ? I heard about the App Proxy but i'm not sure !

Thank you.

0 Likes
Highlighted
Shopify Partner
15 0 4

Hi Jared,

Did you find any way to search with wildcards in API. Currently, the api is not searching for picking the case sensitive words e.g "/admin/products.json?title=Test is not giving me the "test" results.

Thank you,

Ankit

1 Like
Highlighted
New Member
1 0 0

 

perhaps the api changed, but i wanted to note this is not correct

 

 

/admin/products.json?title=<searchString>,limit=250,page=1,fields="id,title,etc"

 

 

rather, you want the extra options added with `&` and not " so instead

 

/admin/api/2020-04/products.json?title=<searchString>&limit=250&fields=id,title

 

also page=1 isn't supported anymore, see here for updated pagination docs https://shopify.dev/tutorials/make-paginated-requests-to-rest-admin-api

 

 

0 Likes