public function Hubspot::hubspotGetRecent in HubSpot 8
Gets the most recent HubSpot leads.
Parameters
int $n: The number of leads to fetch.
Return value
array Returns array of recent hubspot leads activity.
Throws
\GuzzleHttp\Exception\GuzzleException
See also
http://docs.hubapi.com/wiki/Searching_Leads
File
- src/
Hubspot.php, line 325
Class
- Hubspot
- Define a service for interacting with the HubSpot CRM.
Namespace
Drupal\hubspotCode
public function hubspotGetRecent(int $n = 5) : array {
$api = 'https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent';
$options = [
'query' => [
'count' => $n,
],
];
$url = Url::fromUri($api, $options)
->toString();
$result = $this
->request('GET', $url);
$response = $result['response'];
return [
'Data' => $result['value'],
'Error' => isset($response->error) ? $response->error : '',
'HTTPCode' => $response
->getStatusCode(),
];
}