Contact list is empty after request

forms
contacts

#1

Hi.
I have a problem, when I send a request, I get the following response: Status code: 200 Response: HTTP/1.1 200 OK Date: Fri, 12 Jan 2018 11:35:46 GMT Content-Type: application/json; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=d0c7fd5415979472aae3vd02572vf5a3e1515756s46; expires=Sat, 12-Jan-19 11:35:46 GMT; path=/; domain=.hubapi.com; HttpOnly Access-Control-Allow-Credentials: false Vary: Accept-Encoding Vary: Accept-Encoding Server: cloudflare-nginx CF-RAY: 23dsd0710b648400-KBP {“updated”:[],“discarded”:[],“invalidVids”:[],“invalidEmails”:[]}.

But in contact list nothing. Please tell me what can be a problem?

This is my code. (hapi was changed for security reasons)

$arr = array(
‘properties’ => array(
‘vids’ => array(
2365345
),
‘emails’ => array(
‘apitest@hubspot.com’
)
)
);
$post_json = json_encode($arr);
$endpoint = ‘https://api.hubapi.com/contacts/v1/lists/90/add?hapikey=43259973-9223-4b45-vd72-s1cc3hgr95e9’;
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $post_json);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_HEADER, 1);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’));
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = @curl_exec($ch);
$status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
@curl_close($ch);
echo "curl Errors: " . $curl_errors;
echo "\nStatus code: " . $status_code;
echo "\nResponse: " . $response;


#2

Hi @Artem_Kolomoiets,

Can you send me a link to the list in HubSpot so that I can do some testing?


#3

https://app.hubspot.com/lists/3465288/list/90/


#4

Hi @Artem_Kolomoiets,

Thank you for your patience here, but it looks like that list has now been deleted. Was that list a smart list? Contacts cannot be explicitly added to smart lists, since they only contain contacts that meet the filter criteria. Do you have another example list?


#5

I solved this problem. It was that I was trying to add a contact to the list that did not exist. When I created a contact only then I used the API to add to the static list.