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

Creating association as indicated by documentation does not work #271

Open
cacique-coder opened this issue Feb 6, 2024 · 0 comments
Open

Comments

@cacique-coder
Copy link

I was reading the documentation and it does not work as the code indicate.

it raise and error not finding a file "models/object_type"

However running the CURL command it works perfectly.

https://developers.hubspot.com/docs/api/crm/associations

I've tested with versions 17.1 and 17.2

# this code fails
require 'hubspot-api-client'

api_client = Hubspot::Client.new(access_token: 'YOUR_ACCESS_TOKEN')

api_response = api_client.crm.objects.basic_api.create(object_type: "deals", object_id: "DEAL_ID", to_object_type: "contacts", to_object_id: "CONTACT_ID", association_spec: [{"associationCategory":"USER_DEFINED","associationTypeId":ASSOCIATION_ID}])
# This command works
curl --request PUT \
  --url https://api.hubapi.com/crm/v4/objects/deals/DEAL_ID/associations/contacts/CONTACT_ID \
  --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'content-type: application/json' \
  --data '[
  {
    "associationCategory": "USER_DEFINED",
    "associationTypeId": ASSOCIATION_ID
  }
]'
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

No branches or pull requests

1 participant