APIs & Integrations

RCarvalho
Member

deals endpoints with private api key

SOLVE

Hello, 

I have two questions:

1) I'm trying to get the Deals information/properties by id and I'm using the folowing code in python to return only the dealname and date of creation:

 

url = 'https://api.hubapi.com/crm/v3/objects/deal/?limit=100&properties=dealname&properties=createdate'

 

headers = {"Authorization": "Bearer "+ privateApp_token}

response = requests.request(method='get', url = url, headers = headers)

 

But instead of returning just these two properties, all properties are coming and is taking a lot of time because of that.

 

2) Using this endpoint I have a limit of 100 records. I have 215 records of deals. How can I get all of them?

1 Accepted solution
SSukys
Solution
Contributor | Elite Partner
Contributor | Elite Partner

deals endpoints with private api key

SOLVE

Hello @RCarvalho,

 

Thanks for posting. You need to implement the "after" Query Parameter to use Pagination to get the next 100 Deals. 

 

For example, if we look at this API Documentation.

 

The initial result returns the following JSON information. If we look at the "After" parameter we can take that and use it in another query to get the next 100 on the list.

 

 

{
  "results": [
    {
      "properties": {
        "amount": "1500.00",
        "closedate": "2019-12-07T16:50:06.678Z",
        "createdate": "2019-10-30T03:30:17.883Z",
        "dealname": "Custom data integrations",
        "dealstage": "presentationscheduled",
        "hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
        "hubspot_owner_id": "910901",
        "pipeline": "default"
      }
    }
  ],
  "paging": {
    "next": {
      "after": "NTI1Cg%3D%3D",
      "link": "?after=NTI1Cg%3D%3D"
    }
  }
}

 

 

That new query would look like:

url = 'https://api.hubapi.com/crm/v3/objects/deal/?limit=100&after=NTI1Cg%3D%3D&properties=dealname&properties=createdate

 

We insert the "after" and the pagination key to move the query to start at that record and return the next 100. 

 

I hope you find this helpful!

 

If you do, make sure to mark my response as a solution!

View solution in original post

2 Replies 2
SSukys
Solution
Contributor | Elite Partner
Contributor | Elite Partner

deals endpoints with private api key

SOLVE

Hello @RCarvalho,

 

Thanks for posting. You need to implement the "after" Query Parameter to use Pagination to get the next 100 Deals. 

 

For example, if we look at this API Documentation.

 

The initial result returns the following JSON information. If we look at the "After" parameter we can take that and use it in another query to get the next 100 on the list.

 

 

{
  "results": [
    {
      "properties": {
        "amount": "1500.00",
        "closedate": "2019-12-07T16:50:06.678Z",
        "createdate": "2019-10-30T03:30:17.883Z",
        "dealname": "Custom data integrations",
        "dealstage": "presentationscheduled",
        "hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
        "hubspot_owner_id": "910901",
        "pipeline": "default"
      }
    }
  ],
  "paging": {
    "next": {
      "after": "NTI1Cg%3D%3D",
      "link": "?after=NTI1Cg%3D%3D"
    }
  }
}

 

 

That new query would look like:

url = 'https://api.hubapi.com/crm/v3/objects/deal/?limit=100&after=NTI1Cg%3D%3D&properties=dealname&properties=createdate

 

We insert the "after" and the pagination key to move the query to start at that record and return the next 100. 

 

I hope you find this helpful!

 

If you do, make sure to mark my response as a solution!

RCarvalho
Member

deals endpoints with private api key

SOLVE

Hi @SSukys,

 

Thank you for your fast response.

 

It Works

 

0 Upvotes