APIs & Integrations

michaelbarley
Colaborador(a)

How do I get all deals marked as "Closed Won"

resolver

I am wanting to use this information in my application. I'm feeling a little confused about which API I need to use.

0 Avaliação positiva
1 Solução aceita
IsaacTakushi
Solução
HubSpot Employee
HubSpot Employee

How do I get all deals marked as "Closed Won"

resolver

Welcome, @michaelbarley.

 

You can use the brand new CRM Search API to accomplish this.

 

For example, you could make a POST request to https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=YOUR_HUBSPOT_API_KEY with the following body:

{
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "dealstage",
            "operator": "EQ",
            "value": "closedwon"
          }
        ]
      }
    ]
  }

Isaac Takushi

Associate Certification Manager

Exibir solução no post original

3 Respostas 3
IsaacTakushi
Solução
HubSpot Employee
HubSpot Employee

How do I get all deals marked as "Closed Won"

resolver

Welcome, @michaelbarley.

 

You can use the brand new CRM Search API to accomplish this.

 

For example, you could make a POST request to https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=YOUR_HUBSPOT_API_KEY with the following body:

{
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "dealstage",
            "operator": "EQ",
            "value": "closedwon"
          }
        ]
      }
    ]
  }

Isaac Takushi

Associate Certification Manager
michaelbarley
Colaborador(a)

How do I get all deals marked as "Closed Won"

resolver

@IsaacTakushi Thank you very much! Is there any way of only showing deals marked as "Closed Won" within the last 24 hours from when the API call is made? 

 

Thanks in advance,

 

Michael

0 Avaliação positiva
IsaacTakushi
HubSpot Employee
HubSpot Employee

How do I get all deals marked as "Closed Won"

resolver

Hi, @michaelbarley.

 

Yes, you could add a filter for the deal property closedate using a "greater than or equal to" (GTE) operator and set the value to the UNIX millisecond timestamp exactly 24 hours before the current time which you are making the request.

 

For example:

{
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "dealstage",
            "operator": "EQ",
            "value": "closedwon"
          },
          {
            "propertyName": "closedate",
            "operator": "GTE",
            "value": "1580043600000"
          }
        ]
      }
    ]
  }

uses the value 1580043600000, which is about 24 hours before I authored this post, 26 January 2020 at 08:00 EST.

 

You will have to calculate the value on your end before making the request(s).

Isaac Takushi

Associate Certification Manager