Describe the problem/error/question
The API that I am making a call to has a limit of 200. I have to access the paging.next.after value and increment it by 200.
Currently, I am unable to set an expression to access the value of the response, even though I can confirm that, when I make the http request, it has the following schema:
Therefore, I set the expression to: $response[0].json.paging.next.after, since the value of the previous http request should give me the limit that I can then pass to the next request.
I have confirmed that this the correct way of accessing the properties in the attached code node:
Thank you for your assistance!
Joseph
What is the error message (if any)?
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.95.3
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system:
Without having an account to test with, I assume the http request node should look somewhat like this to work:
It looks almost exactly like that, except for the difference in the path to the object property, which I have as {{ $response[0].json.paging.next.after }} based on my experiment with the response outlined in the workflow quoted above. Sharing the node again below:
Thank you for your help.
Ok, so version does work for you?
Sorry, I should have specified above: no. I tried running it with both syntaxes, with your suggestion for chaining and mine, adding the undefined criterion for stopping. Both failed:
Hmm, this is odd, could you try to upgrade to the latest version of n8n?
Done and still failing:
Could it be that the after value is initially defined as 0 in the body? Is there a different way that I should format it?
I am seeing that there is a post by @Jon here that looks very similar to what I am trying to do. The main difference is that he is using the default 'Using fields below" option for the body content.
My body is formatted like such:
{
"filterGroups": [
{
"filters": [
{
"propertyName": "school_id",
"operator": "HAS_PROPERTY"
}
]
}
],
"properties":["school_id","name"],
"limit": 200,
"after": 0
}
I am wondering if there is a way to reproduce that using the default field values, especially since after is a variable, or if I need to format it as raw JSON.
Ok, I created hubspot account, configured auth app, created 10 companies and ran the following search to list all of them:
Since I’ve limited the response to 3 at a time, there are 4 requests that had to be made:
The syntax change solved my issue! I have another issue now, but it is HubSpot related and has to do with This endpoint is limited to 10000 total results for any given query. Try adding filters or updating your query to return fewer results. . The documentation is not very satisfying. I’ll leave it there for this forum though. Thank you!