Retrieve Contact Information from HubSpot
In this example, we use the Has next field to retrieve the list of users created most recently in HubSpot, and then separate the user information from other details in the API response.
.jpg)
Download this Pipeline
The following steps describe how to retrieve contact details from HubSpot using REST Get and JSON Splitter Snaps.
-
Configure the REST Get Snap to retrieve user information from HubSpot
Configure the REST Get Snap without the pagination details (Has Next and Next URL fields).
.png)
-
Validate the Snap. After validation, the Snap displays the output with only 20
records and shows the has-more value as
true, indicating that there are more records available..png)
-
Configure the Has Next and Next
URL fields:
.jpg)
REST Get configuration details: The following configuration details are key to understanding this example:Field Value Description Service URL https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demoThis is a demo API offered by HubSpot, which returns details of all contacts created in the demo account in descending order. This API only scrolls back 30 days in time. Has next $entity['has-more']The REST Get Snap lists 20 documents by default. If more contacts were created during the previous 30 days, this API returns truefor the key has-more.Next URL "https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&vidOffset=" + $entity['vid-offset']This URL retrieves the next set of 20 documents. In this URL, vid-offset is the ID of the last user retrieved in the preceding call. For example, if the last user ID in the response is 12345, that becomes the value of the vid-offset parameter.Execute the Snap—it lists out API response entities in sets of 20, until the last contact information is listed out, and the
has-morefield changes to false:.png)
.jpg)
-
Configure the JSON Splitter Snap. The output from the REST Get Snap contains
several details. To extract only the user details (available in the
entity.contactsarray), configure the JSON Splitter Snap to isolate the required information..jpg)
The output from the JSON Splitter Snap contains only the contact information you need.
.png)