<?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 Search API - Fetch Associations? in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Search-API-Fetch-Associations/m-p/860700#M68012</link>
    <description>&lt;P&gt;In Search API (described here:&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/api/crm/search" target="_blank" rel="noopener"&gt;https://developers.hubspot.com/docs/api/crm/search&lt;/A&gt;) is it possible to fetch associations of objects (at least their IDs)?&lt;BR /&gt;&lt;BR /&gt;Let's say I want to Search for contacts, but in the response properties I want to get their associations as well (notes, tasks, companies).&lt;BR /&gt;&lt;BR /&gt;Is such a query possible at all?&lt;BR /&gt;&lt;BR /&gt;The one I tried, doesn't return associations at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;curl --location 'https://api.hubapi.com/crm/v3/objects/contacts/search' \
--data '{
    "limit": 100,
    "associations": ["notes","tasks","companies","deals"]
}'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In comparison for a regular API I am able to fetch the associations IDs with this call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;GET https://api.hubapi.com/crm/v3/objects/contacts?associations=tasks,notes,companies,deals&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Oct 2023 09:25:46 GMT</pubDate>
    <dc:creator>dmydlarz</dc:creator>
    <dc:date>2023-10-06T09:25:46Z</dc:date>
    <item>
      <title>Search API - Fetch Associations?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-API-Fetch-Associations/m-p/860700#M68012</link>
      <description>&lt;P&gt;In Search API (described here:&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/api/crm/search" target="_blank" rel="noopener"&gt;https://developers.hubspot.com/docs/api/crm/search&lt;/A&gt;) is it possible to fetch associations of objects (at least their IDs)?&lt;BR /&gt;&lt;BR /&gt;Let's say I want to Search for contacts, but in the response properties I want to get their associations as well (notes, tasks, companies).&lt;BR /&gt;&lt;BR /&gt;Is such a query possible at all?&lt;BR /&gt;&lt;BR /&gt;The one I tried, doesn't return associations at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;curl --location 'https://api.hubapi.com/crm/v3/objects/contacts/search' \
--data '{
    "limit": 100,
    "associations": ["notes","tasks","companies","deals"]
}'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In comparison for a regular API I am able to fetch the associations IDs with this call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;GET https://api.hubapi.com/crm/v3/objects/contacts?associations=tasks,notes,companies,deals&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 09:25:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-API-Fetch-Associations/m-p/860700#M68012</guid>
      <dc:creator>dmydlarz</dc:creator>
      <dc:date>2023-10-06T09:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Search API - Fetch Associations?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-API-Fetch-Associations/m-p/860815#M68014</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/619278"&gt;@dmydlarz&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure whether you can pull associations in the same API call. Would it be work to split the API calls, so that Search pulls the record IDs of the object you want, and then you use another API call to pull associations?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Zach&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 12:56:05 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-API-Fetch-Associations/m-p/860815#M68014</guid>
      <dc:creator>zachh</dc:creator>
      <dc:date>2023-10-06T12:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Search API - Fetch Associations?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-API-Fetch-Associations/m-p/868597#M68460</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/392101"&gt;@zachh&lt;/a&gt;&amp;nbsp;I have a following question.&lt;BR /&gt;When I pull IDs via Search API, I would like to fetch obejcts details with their associations in a single call.&lt;BR /&gt;&lt;BR /&gt;Would that be possible?&lt;BR /&gt;&lt;BR /&gt;I'm exploring BATCH API, but regardless what docs says, I'm not getting associations in a response at all.&lt;BR /&gt;&lt;BR /&gt;(Docs:&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/api/crm/contacts#retrieve-contacts" target="_blank" rel="noopener"&gt;https://developers.hubspot.com/docs/api/crm/contacts#retrieve-contacts&lt;/A&gt; says that for Batch API I can put "associations" as query param.)&lt;BR /&gt;&lt;BR /&gt;But I tried this, and also putting it into the body requests, and associations are not returned at all.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;POST /crm/v3/objects/contacts/batch/read?associations=companies
Host: api.hubapi.com

{
  "properties": ["email", "lastname", "firstname", "jobtitle" ],
  "associations": ["companies"],
  "inputs": [
    { "id": "251" }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The response is:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "status": "COMPLETE",
    "results": [
        {
            "id": "251",
            "properties": {
                "createdate": "2023-09-18T09:25:05.587Z",
                "email": "john@example.com",
                "firstname": "John",
                "hs_object_id": "251",
                "jobtitle": null,
                "lastmodifieddate": "2023-10-11T06:04:46.785Z",
                "lastname": "Doe"
            },
            "createdAt": "2023-09-18T09:25:05.587Z",
            "updatedAt": "2023-10-11T06:04:46.785Z",
            "archived": false
        }
    ],
    "startedAt": "2023-10-23T13:14:43.939Z",
    "completedAt": "2023-10-23T13:14:43.944Z"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how to overcome this?&lt;BR /&gt;&lt;BR /&gt;Hopefully I'm not forced to do "N" requests for every ID I am interested in?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 13:22:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-API-Fetch-Associations/m-p/868597#M68460</guid>
      <dc:creator>dmydlarz</dc:creator>
      <dc:date>2023-10-23T13:22:24Z</dc:date>
    </item>
  </channel>
</rss>

