How get DISCOUNT Catalog List (Product List) In Node Js API

I Need to get DISCOUNT Details + Product Details So I can Show them in my Web Application and Appy DISCOUNT ID When Order Create E/P.

But I can get DISCOUNT Details but there are no Item details How can I get them?

This is my code implementation that I am trying to get data.

      const catalogApi = this.client.catalogApi;
      const allProducts = await catalogApi.listCatalog(
        undefined,
        "ITEM",
        undefined,
        undefined
      );
  const allProductList = await catalogApi.searchCatalogObjects({
    //TODO: add this filter if not match the return value for currant list MODIFIER
    objectTypes: ["DISCOUNT","PRICING_RULE"],
    includeRelatedObjects: true,
    includeDeletedObjects: false,
  });

Example Object Result :-

    {
        "type": "DISCOUNT",
        "id": "V4CTUH",
        "updatedAt": "2023-11-02T20:52:53.781Z",
        "version": "1698958373781",
        "isDeleted": false,
        "presentAtAllLocations": true,
        "absentAtLocationIds": [
            "L5K9GH0DWZV0P"
        ],
        "discountData": {
            "name": "COFFEE4MATES",
            "discountType": "FIXED_PERCENTAGE",
            "percentage": "100.0",
            "pinRequired": false,
            "modifyTaxBasis": "MODIFY_TAX_BASIS"
        }
    },

There is no related object Id or anything

I took a look at the account and I see that your making successful API calls to the Catalog API. What data are you expecting that’s not being returned? :slightly_smiling_face:

@Bryan-Square DISCOUNT Details of Item

Are you trying to get the related_objects from a DISCOUNT or are you trying to get the related_objects from an ITEM? :slightly_smiling_face:

@Bryan-Square Need to get related_objects witha DISCOUNT

Spoke to the team about this and discounts won’t return related objects since they are a bottom level object of catalog objects. If you were to request the related_objects of a PRICING_RULE, ITEM, or ITEM_VARIATION the discount will be returned. This is cause the other level object types reference the lower level DISCOUNT object.

If you’d like to get the discount details of products your selling in your web application you’ll want to get the related_objects of the ITEM or ITEM_VARIATION. :slightly_smiling_face: