Getting all the “collects” given a collection id using shopify-api-node

New Member
4 0 0

I need to get all the collects of a given collection.

With the shopify-node-api package (which no longer works for new versions of the api), you could do something like this:


On this page, it shows how you would construct a url to get all the collects for a given collection: GET /admin/api/2021-01/collects.json?collection_id=841564295

How do I use the shopify-api-node package to generate that? I've written this function but it doesn't work:

async _new_getAllCollectsByCollection(id) {
    let params = {collection_id: id};
    let list = [];

    while(params) {
        const collects = await this.newShopify.collect.list(params);
        list = list.concat(collects);
        params = collects.nextPageParameters;

    return list;

But when I run the api with those params, I get this: Response code 404 (Not Found)