JSON List of vendors API

Highlighted
New Member
3 0 1

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
Highlighted
Shopify Staff
Shopify Staff
1129 82 185

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
Highlighted
New Member
3 0 1

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.

1 Like
Highlighted

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
2 Likes
Highlighted

You can create a new page template in Shopify Themes with the bellow code:

{% layout none %}{{shop.vendors|json}}

Assign this template for a page and you have a page include all vendors with JSON format.

Demo: https://hmak1.myshopify.com/pages/about-us?view=vendor

0 Likes
Highlighted
Tourist
8 0 1

There is a bug in pagination.

0 Likes