JSON List of vendors API

New Member
3 0 0

Hello, is it possible to somehow access this api: '/admin/api/2019-07/products/vendors.json' I think I have the proper access scopes (read_products), and now I'm getting a 404 error.

 

I want to get a list of all available vendors

0 Likes
Shopify Staff
Shopify Staff
1112 77 153

Hey @dask , 

 

The REST Product API doesn't have an endpoint that will specifically list only the unique vendors on products in a shop. However, it does have the ability to only list specific product fields through the fields parameter. 

 

So what you could do is loop through all the products on a shop using /admin/products.json?fields=vendor, and this will give you all of the vendors from each product - the catch being it will loop through each and every product and output their vendor, regardless of if it is a duplicate or not. You would then have to take the response and remove any duplicates yourself - but this would allow you to retrieve all of a shop's product vendors.

0 Likes
New Member
3 0 0

Hello @Josh , thanks for the reply!

 

What I forgot to add: I can actually access this endpoint through the browser! So I didn't just make it up, it exists and is accessible, just not with the Access Token I get for the app.

0 Likes

I've been looking for an answer to this for a while, finally found a solution using the GraphQL API:-

query productVendors {
  shop {
    productVendors(first: 200) {
      edges {
        node
      }
    }
  }
}

So if you tuck is into a proxy app, say on a AWS lambda script via API gateway, you can get all the vendors.

Swapping productVendors for productTypes will give you all the types for a store.

Some Shopify/Ecommerce related articles - https://medium.com/@stephenkeable
0 Likes