skerdi
December 3, 2024, 10:29am
1
On November 26, HubSpot started returning incorrect next links for paging when querying the Associations API. I’m issuing the following request:
GET https://api.hubapi.com/crm/v4/objects/companies?limit=1&associations=deals&archived=false
I get the following response:
{
"results": [
{
"id": "21350299152",
"properties": {...},
"createdAt": "2024-06-10T08:08:35.227Z",
"updatedAt": "2024-10-28T15:50:09.488Z",
"archived": false,
"associations": {
"deals": {
"results": [...],
"paging": {
"next": {
"after": "MC02LTIzMjI0NjY2MDA1",
"link": "https://api-na1.hubapi.com/crm/v3/objects/0-2/21350299151/associations/0-3?portalId=xxxxxxx&after=MC02LTIzMjI0NjY2MDA1"
}
}
}
}
}
],
"paging": {
"next": {
"after": "21350299152",
"link": "https://api.hubapi.com/crm/v4/objects/companies?associations=deals&archived=false&limit=1&after=21350299152"
}
}
}
As can be seen from the response, the next link for the paging of deals associtations is incorrect as it is from the V3 API:
https://api-na1.hubapi.com/crm/v3/objects/0-2/21350299151/associations/0-3?portalId=xxxxxxx&after=MC02LTIzMjI0NjY2MDA1
Another minor issue is that HubSpot is returning region-specific hosts while in this blog post they claim that the data center should be resolved internally. This issue is also happening when working with the V3 API.
While the general next link for paging is returned just fine with the
api.hubapi.com host.
Hey, @skerdi Thanks for your post. For your second issue, will you make a submission to the form linked here, please? https://community.hubspot.com/t5/Developer-Announcements/️Announcing-the-new-Developer-Feedback-Tool-Available-Now/td-p/1064751
For Q1, I can’t reproduce this behaviour using my test portal. I also wasn’t able to find any support tickets for this issue. What happens if you make the same request using Postman? Here’s my test using Postman:
Request
GET https://api.hubapi.com/crm/v4/objects/companies?limit=1&associations=deals&archived=false
Response
{
"results": [
{
"id": "9291675216",
"properties": {
"createdate": "2022-08-02T17:49:46.873Z",
"domain": null,
"hs_lastmodifieddate": "2024-10-26T09:53:35.766Z",
"hs_object_id": "9291675216",
"name": "My Cat Circus"
},
"createdAt": "2022-08-02T17:49:46.873Z",
"updatedAt": "2024-10-26T09:53:35.766Z",
"archived": false,
"associations": {
"deals": {
"results": [
{
"id": "9786091184",
"type": "company_to_deal_unlabeled"
}
]
}
}
}
],
"paging": {
"next": {
"after": "9291675217",
"link": "https://api.hubapi.com/crm/v4/objects/companies?associations=deals&archived=false&limit=1&after=9291675217"
}
}
}
Which returns the expected format for paging with the v4 endpoint.
Thanks for the additional information! — Jaycee
skerdi
December 4, 2024, 9:31am
3
Hi @Jaycee_Lewis ,
The issue pertains to Association pagination, where the pagination link appears inside the associations/<CRM object> object. I noticed your response contains only one association between Companies and Deals. More associations are needed to trigger the pagination mechanism. For example:
Request:
https://api.hubapi.com/crm/v4/objects/companies?limit=100&associations=contacts%2Ctickets%2Cdeals%2Cquotes%2Ctasks%2Cnotes%2Cmeetings%2Cemails%2Ccalls&archived=false
Response:
{
"results": [
{
"id": "22855278340",
"properties": {
"createdate": "2024-09-10T09:11:20.051Z",
"domain": "test.com",
"hs_lastmodifieddate": "2024-11-27T16:50:34.883Z",
"hs_object_id": "22855278340",
"name": null
},
"createdAt": "2024-09-10T09:11:20.051Z",
"updatedAt": "2024-11-27T16:50:34.883Z",
"archived": false,
"associations": {
"deals": {
"results": [...],
"paging": {
"next": {
"after": "MC0zNDItMTk5MzM1NDk5MDQ%3D",
"link": "https://api-na1.hubapi.com/crm/v3/objects/0-2/22855278340/associations/0-3?portalId=45482352&after=MC0zNDItMTk5MzM1NDk5MDQ%3D"
}
}
}
}
}
],
"paging": {
"next": {
"after": "xxx",
"link": "xxx"
}
}
}
If you examine the next link retrieved from:
/results/associations/deals/paging/next/link
The link is:
https://api-na1.hubapi.com/crm/v3/objects/0-2/22855278340/associations/0-3?portalId=45482352&after=MC0zNDItMTk5MzM1NDk5MDQ%3D
This points to a v3 endpoint instead of v4. These tests were conducted using Postman. Could you please clarify if this behavior is expected? Should I report this issue in the Developer Feedback Tool as well?