Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associations (get_by_id) #262

Open
dtakeshta opened this issue Oct 19, 2023 · 3 comments
Open

Associations (get_by_id) #262

dtakeshta opened this issue Oct 19, 2023 · 3 comments

Comments

@dtakeshta
Copy link

dtakeshta commented Oct 19, 2023

I'm having a little trouble with reading associations using get_by_id. Any help would be greatly appreciated.

Using the hubspot docs to send test requests using my oauth token, the associations are returned in the response. I have also tested this works using postman.

{
  ...
  "associations": {
    "companies": {
      "results": [
        {
          "id": "15934562324",
          "type": "deal_to_company"
        },
        {
          "id": "15934562324",
          "type": "deal_to_company_unlabeled"
        }
      ]
    },
    "contacts": {
      "results": [
        {
          "id": "316451",
          "type": "deal_to_contact"
        }
      ]
    }
  }
}

With this library, I can see the associations array is being included in the request
:associations=>["company", "contact"]

#<Hubspot::Crm::Deals::SimplePublicObjectWithAssociations:0x000000010f377890
 @archived=false,
 @created_at=2023-10-18 20:40:48.263 UTC,
 @id="15691491587",
 @properties=
  {"createdate"=>"2023-10-18T20:40:48.263Z",
   "dealname"=>"Big Money",
   "hs_lastmodifieddate"=>"2023-10-19T18:07:59.292Z",
   "hs_object_id"=>"15691491587"},
 @updated_at=2023-10-19 18:07:59.292 UTC>

FWIW, here is what my code looks like:

api_client.crm.deals.basic_api.get_by_id(
          deal_id: 'deal_id',
          properties: %w[dealname],
          associations: %w[company contact],
          archived: false
        )
@kaliara
Copy link

kaliara commented Oct 23, 2023

Hey @dtakeshta and @alzheltkovskiy-hubspot, I ran into this issue myself and noticed that using :csv over :multi here seems to fix the issue. I submitted PR #263 with that change, but I'm not super familiar with the Hubspot API so please disregard if it causes any issues.

In the meantime @dtakeshta, you can give the fork a try to see if it solves your issues: https://github.com/rescale-supply/hubspot-api-ruby/tree/bug/associations23102023

@leesmith
Copy link

I'm trying to get contact associations for a company and get_by_id doesn't work me either.

@cg-akapoor
Copy link

@alzheltkovskiy-hubspot is there a way around this or plans to fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants