Using SearchResults API to pull deals

#1

Hi,
We want to pull all deals that were won / lost / open in a specific time period.
For example - all deals opened between Jan 1st 2019 to Jan 10th 2019.
All deals won between these dates, etc.
The time frames themselves will change so we can’t use a pre-defined filter and want to avoid building one on the fly.
Is it possible with the SearchResults API and if so how?

Thanks,
David

#2

Creating a filter (programmatically, via API) is actually the easiest way. I would reconsider doing that first.

If you really don’t want to create filters, yes, you could use the searchResults/field endpoint to get the ids for each day included in your range.

Here’s the example for one specific day:

  1. field_type: dealField
    field_key: won_time
    return_item_ids: 1
    term: 2018-12-24

You would have to make a call for each day included in your range + all the calls to get the deals’ info from the id. That’s a lot of unnecessary calls.

An alternative method would be keeping a copy of deals added, won, and lost on your own database, synced via webhooks. That way you can do anything you need with them.

I hope that helps :slight_smile:

1 Like
#3

Hi @dani, thanks a lot! Indeed pulling the deals day by day is cumbersome and heavy.
If those are the options, then we would go with the dynamic creation of filters.

Best,
David

2 Likes