Accessing Wix Collections through Velo API

I’m using Gelato’s App to push products inside my Wix Store.

It is working well, but I would like to create an automation with an action to access my products through Velo API.

My problem is that those products are not accessible through “Stores/Products”. API is simply returning that the list is empty.
I found that the current Gelato collection name is “Stores/IventoryItems”, but that doesn’t work neither.

What would be the way to access those products ? I was wondering if it was something to do with authorization. But I can’t figure what it is.

import wixData from "wix-data";
import { products } from "wix-stores.v2";

export const invoke = async ({payload}) => {
  try {
    const result = await products.getCollectionBySlug("Stores/InventoryItems");
    console.log("1. Stores/InventoryItems: ", result);
  } catch (error) {
    console.error("1. Stores/InventoryItems: ", error);
    // Handle the error
  }
  try{
wixData
  .query("Stores/InventoryItems")
  .find()
  .then((results) => {
    console.log("2. Stores/InventoryItems: ", results);
  });
  }catch(error){
    console.log("2. Stores/InventoryItems: ", error);
  }
  try {
    const result = await products.getCollectionBySlug("Stores/Variants");
    console.log("1. Stores/Variants: ", result);
  } catch (error) {
    console.error("1. Stores/Variants: ", error);
    // Handle the error
  }
  try{
wixData
  .query("Stores/Variants")
  .find()
  .then((results) => {
    console.log("2. Stores/Variants: ", results);
  });
  }catch(error){
    console.log("2. Stores/Variants: ", error);
  }
  return {} // The function must return an empty object, do not delete
};

Have you explored using the queryInventory option - Query Inventory | SDK - from what I understand, it’ll work similarly to how Wix Data works, but is designed for working with the inventory data :slight_smile: