Listing deals with their products

Question asked here: (https://stackoverflow.com/questions/46545199/listing-deals-with-their-products)

I need to list all the deals and their products using Pipedrive REST API. Anyone know how to do it?

Thanks in advance

Response via: Michael Hirschler

You can get all Deals with this call: GET /deals

After retrieving the response, you can iterate every Deal and call another API call: GET /deals/{id}/products

So a (pseudo-)code example could look something like this:

DEALS = GET /deals

for DEAL in DEALS
  DEAL_ID = DEAL.ID
  PRODUCTS = GET /deals/DEAL_ID/products

Hey David,

I am currently using this iterative process of ‘get deal’ -> ‘get products’, but I have many deals and each deal has very few products (6-15).

Is there a method that exposes our deal-products xrefs, so that I can use /v1/deals, /v1/products, and then do the joins in my code?

If I could pull 500 products per GET /v1/products, and 500 deals per GET/v1/deals, this would reduce the amount of requests I’m currently making by a factor of 100 (at least)!

Thanks!
-Doug