Retrieving Contact Information from HubSpot Using Upstream Values
In this example, we use values from the upstream Snap in the Has next property of the REST Get Snap to retrieve the list of users created most recently in HubSpot.
.jpg)
Download this Pipeline
The following steps describe how to configure Snaps to retrieve contact details from HubSpot using upstream values.
-
Configure the JSON Generator Snap
In the JSON Generator Snap, enter the endpoint URL as follows:
[ { "url" : "https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&vidOffset" } ]Execute the Snap—it gets the following output containing the initial endpoint information to be used by downstream Snaps.
.jpg)
-
Configure the REST Get Snap to retrieve user information from HubSpot.
.jpg)
The following configuration details are critical to understand 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 lists out a few details of the most recently created users in descending order. This API only scrolls back 30 days in time. Has next $entity['has-more']The Get all contacts API offers 20 documents by default. If there are more contacts created during the 30 days preceding the call, this API returns truefor the key has-more.Next URL $original.url + "=" + $entity['vid-offset']This expression uses the value received from the upstream JSON Generator Snap to create the URL that the Snap calls to retrieve the next set of documents. In this URL, vid-offset is the ID of the last user whose details were retrieved in the preceding call. For example, if the ID of the last user in the API response is 12345, then that will be 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.jpg)