Getting all products attached to one deal

Hey everyone, i would like to get all the products attached to one deal using the deal ID but i don’t really know how to do it.

For now i have this script that give all and more that i want about deals, but i can’t find a way to get the products informations attached to the deal.

tfunction CallAPI(deal_id) {
  var deal_id = sheet.getRange(2,3).getValue();
  var token ='XXXXXX';
  var url   = "https://company.pipedrive.com/api/v1/deals/"+ deal_id +"/products?api_token="+token;
  
  var response = UrlFetchApp.fetch(url); 
  var dataSet = JSON.parse(response.getContentText()); 
  var data = dataSet.data;

  sheet.appendRow([data]);

}

Appreciate any help

Welcome to the community @JuloSancho !
I see that you are using the right API - Pipedrive API v1 Reference

Have you tried using the include_product_data parameter?

Tanks @Hem, the problem was somewhere else, i didn’t paid much attention on what was returned by data on my table (ljava.lang.object), i just added this const myJSON = JSON.stringify(data); to my code and it gave me all i wanted, thx for your help :slight_smile:

1 Like