<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Deal search with specific property update datetime. in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Deal-search-with-specific-property-update-datetime/m-p/1001930#M74804</link>
    <description>&lt;P&gt;Can we have any end point available to search deals records by&amp;nbsp;specific property update datetime?&lt;BR /&gt;&lt;BR /&gt;Ex. I have one property 'end date' in the deal. Now I want deal records that have&amp;nbsp;'end date' property updated after specific datetime.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jul 2024 06:52:57 GMT</pubDate>
    <dc:creator>sshahdev</dc:creator>
    <dc:date>2024-07-08T06:52:57Z</dc:date>
    <item>
      <title>Deal search with specific property update datetime.</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Deal-search-with-specific-property-update-datetime/m-p/1001930#M74804</link>
      <description>&lt;P&gt;Can we have any end point available to search deals records by&amp;nbsp;specific property update datetime?&lt;BR /&gt;&lt;BR /&gt;Ex. I have one property 'end date' in the deal. Now I want deal records that have&amp;nbsp;'end date' property updated after specific datetime.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 06:52:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Deal-search-with-specific-property-update-datetime/m-p/1001930#M74804</guid>
      <dc:creator>sshahdev</dc:creator>
      <dc:date>2024-07-08T06:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Deal search with specific property update datetime.</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Deal-search-with-specific-property-update-datetime/m-p/1002272#M74826</link>
      <description>&lt;P&gt;Hi!!&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/255420"&gt;@sshahdev&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can have this information changed via workflows for an after specific datetime&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sam_baybrad_0-1720460583586.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/121340i7BC9C3212C1A0ECD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sam_baybrad_0-1720460583586.png" alt="sam_baybrad_0-1720460583586.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 17:44:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Deal-search-with-specific-property-update-datetime/m-p/1002272#M74826</guid>
      <dc:creator>sam_baybrad</dc:creator>
      <dc:date>2024-07-08T17:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Deal search with specific property update datetime.</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Deal-search-with-specific-property-update-datetime/m-p/1002273#M74827</link>
      <description>&lt;P&gt;Another option -&amp;nbsp;&lt;/P&gt;&lt;P&gt;To search for deal records that have a specific property (like 'end date') updated after a certain datetime, you can use the HubSpot API. While there isn't a direct endpoint to search deals based on property update datetime, you can achieve this by combining the Deal API and the engagement timestamps.&lt;/P&gt;&lt;H3&gt;Steps to Achieve This:&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Retrieve All Deals&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;First, you need to retrieve all deals using the &lt;A href="https://developers.hubspot.com/docs/api/crm/deals" target="_new" rel="noreferrer"&gt;HubSpot Deals API&lt;/A&gt;. You can use the GET /crm/v3/objects/deals endpoint to fetch deals.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Filter Deals by Property Update&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;After retrieving the deals, you will need to filter them based on the end date property update timestamp. Unfortunately, HubSpot does not provide a direct filter in the API for this, so you will have to handle this logic in your code.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Example Implementation in Python:&lt;/H3&gt;&lt;P&gt;Here’s an example of how you might implement this in Python:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;from datetime import datetime&lt;/P&gt;&lt;P&gt;# HubSpot API key&lt;BR /&gt;api_key = 'YOUR_HUBSPOT_API_KEY'&lt;/P&gt;&lt;P&gt;# Endpoint to get all deals&lt;BR /&gt;url = '&lt;A href="https://api.hubapi.com/crm/v3/objects/deals" target="_blank" rel="noopener"&gt;https://api.hubapi.com/crm/v3/objects/deals&lt;/A&gt;'&lt;/P&gt;&lt;P&gt;# Parameters for the request&lt;BR /&gt;params = {&lt;BR /&gt;'hapikey': api_key,&lt;BR /&gt;'properties': 'end_date,lastmodifieddate',&lt;BR /&gt;'limit': 100&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Function to get deals from HubSpot&lt;BR /&gt;def get_deals(url, params):&lt;BR /&gt;deals = []&lt;BR /&gt;while url:&lt;BR /&gt;response = requests.get(url, params=params)&lt;BR /&gt;response_data = response.json()&lt;BR /&gt;deals.extend(response_data.get('results', []))&lt;BR /&gt;url = response_data.get('paging', {}).get('next', {}).get('link')&lt;BR /&gt;return deals&lt;/P&gt;&lt;P&gt;# Get all deals&lt;BR /&gt;all_deals = get_deals(url, params)&lt;/P&gt;&lt;P&gt;# Specific datetime to filter&lt;BR /&gt;specific_datetime = datetime.strptime('2023-01-01T00:00:00Z', '%Y-%m-%dT%H:%M:%SZ')&lt;/P&gt;&lt;P&gt;# Filter deals based on end_date property update&lt;BR /&gt;filtered_deals = []&lt;BR /&gt;for deal in all_deals:&lt;BR /&gt;end_date = deal['properties'].get('end_date')&lt;BR /&gt;last_modified = deal['properties'].get('lastmodifieddate')&lt;BR /&gt;if end_date and last_modified:&lt;BR /&gt;last_modified_datetime = datetime.strptime(last_modified, '%Y-%m-%dT%H:%M:%SZ')&lt;BR /&gt;if last_modified_datetime &amp;gt; specific_datetime:&lt;BR /&gt;filtered_deals.append(deal)&lt;/P&gt;&lt;P&gt;# Print filtered deals&lt;BR /&gt;for deal in filtered_deals:&lt;BR /&gt;print(deal)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 17:45:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Deal-search-with-specific-property-update-datetime/m-p/1002273#M74827</guid>
      <dc:creator>sam_baybrad</dc:creator>
      <dc:date>2024-07-08T17:45:20Z</dc:date>
    </item>
  </channel>
</rss>

