How can I GET all associations for any Object? For Example, I want to GET companies and contacts associated with leads, as well as GET companies, leads, and contacts for Deals.
Is there any way or endpoint URL for that?
@Asher_Sajid - my experience is that you request lists of associations for each object type of interest. So separate API calls for Contacts, Deals, Companies, etc.
At the schema level you can see the range of potential association types that have been set up for any object type.
Hope this is helpful.
Steve
If you have access to GraphQL, you would be able to pull more associations in a single request than through the normal APIs. You’ll still have to define the associations you want but it can simplify retrieving a lot of data.
Eg,
This graphQL pulls the lead, companies associated to the lead, contacts associated with the company and deals associated with the lead.
Collections allow multiple objects to be returned.
query MyQuery {
CRM {
lead(uniqueIdentifier: "", uniqueIdentifierValue: "") {
associations {
company_collection__primary {
items {
name
domain
associations {
contact_collection__company_to_contact {
items {
firstname
lastname
}
}
}
}
}
deal_collection__primary {
items {
dealname
}
}
}
}
}
}
Would return something like:
{
"data": {
"CRM": {
"lead": {
"associations": {
"company_collection__primary": {
"items": [
{
"name": "ABC, Inc.",
"domain": "ABC.com",
"associations": {
"contact_collection__company_to_contact": {
"items": [
{
"firstname": "Lorem",
"lastname": "Ipsum"
},
{
"firstname": "Dolor",
"lastname": "Sit"
},
{
"firstname": "Consectetur",
"lastname": "Adipiscing"
},
{
"firstname": "Elit",
"lastname": "Pharetra"
},
]
}
}
}
]
},
"deal_collection__primary": {
"items": []
}
}
}
}
},