APIs & Integrations

fernando2
Miembro

i want to capth name, email in code, how I do?

<?php

require 'vendor/autoload.php';

use SevenShores\Hubspot\Http\Client;
use SevenShores\Hubspot\Resources\Contacts;

$client = new Client(['key' => 'REDACTED']);

$contacts = new Contacts($client);

$response = $contacts->email();

foreach ($response->contacts as $contact) {
var_dump ($contact);
 
}
1 Respuesta 1
lscanlan
Exmiembro de HubSpot
Exmiembro de HubSpot

i want to capth name, email in code, how I do?

Hi @fernando2,

 

First, I've removed the API key from your posts. But I would strongly recommend deactivating your current key and then generating a new one, which you can read about here: https://knowledge.hubspot.com/articles/kcs_article/integrations/how-do-i-get-my-hubspot-api-key. By posting the key in the forum here, you've compromised it.

 

As for your specific code, could you give me a bit more info about what "Client" and "Contacts" are? Are you making requests to our Contacts API (https://developers.hubspot.com/docs/methods/contacts/get_contacts for example)?

 

I'm not entirely sure what your data looks like, but from our API you can include the properties that you want in the response for each contact. It's documented in the URL I included above, but you can include &property= in the query string of your request URL. So for example: https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=XXXX&property=email&property=first... . That will include the values for those properties in the response for each object, assuming the contact record has values for those properties.

 

If you're still having trouble, just let me know how you're making the request and I'll be happy to look again.

Leland Scanlan

HubSpot Developer Support
0 Me gusta