Need to FDK method to fetch all categories, brands and products at company level (whole catalog)

  1. We need to first fetch the whole list of all the categories at company level and not for any particular channel to show in a dropdown.
  2. Once user selects a category, we need to show all the brands available for that category.
  3. Once user selects a brand, we need to show all the products in catalog for that brand.

Need an FDK method which can cater to this requirement. Creating this ticket as suggested by Jay.

You can retrieve all the application ids then you can call categories APIs for them, right we dont have any feature to directly get all the categories in company level.

FYR :


const getAllCategories = async () => {
  try {
    // Fetch and set the OAuth token
    const token = await platformConfig.oauthClient.getAccesstokenObj({
      grant_type: "client_credentials",
    });
    platformConfig.oauthClient.setToken(token);

    // Initialize platform client
    const platformClient = new PlatformClient(platformConfig);

    // Fetch applications
    const { items: applications } =
      await platformClient.configuration.getApplications({
        companyId: 8040,
      });

    // Iterate through each application to fetch departments and categories
    for (const app of applications) {
      console.log(`Application: ${app.name}`);

      const { items: departments } = await platformClient
        .application(app._id)
        .catalog.getApplicationDepartmentListing({
          companyId: "8040",
          applicationId: app._id,
        });

      for (const department of departments) {
        console.log(`  Department: ${department.name}`);

        const categories = await platformClient
          .application(app._id)
          .catalog.getCategories({
            companyId: "8040",
            applicationId: app._id,
            departmentId: department._id,
          });
        console.log(JSON.stringify(categories));
      }
    }
  } catch (error) {
    console.error("Error fetching categories:", error);
  }
};

For this this you can refer this.

Refer below link.

Also let me know any help needed.