We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Nov 24, 2017 3:04 AM
All,
I’m having trouble using the Hubspot API and I’m always getting a 403 Access Denied message.
I’ve included the encoded JSON. Of course I’m using my own HAPIkey which is relevant to my portal.
I’m currently using the free version of the CRM. I suppose this is not the problem?
My own site is https to and i am using https tp call the API (see sample code below).
I have tried to add curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); in order to avoid certificate checking problems, but no avail.
The url I’m calling is “api.hubapi.com/contacts/v1/contact/createOrUpdate/email/$email/?hapikey=” and is HTTPS.
Can anybody assist ?
Thanks a lot !
<<<< HUBSPOT API RESPONSE >>>
07:38:41POST : {“properties”:[{“property”:“email”,“value”:“ranger@bisaerts.be”},{“property”:“phone”,“value”:""},{“property”:“address”,“value”:""},{“property”:“zip”,“value”:""},{“property”:“city”,“value”:""},{“property”:“firstname”,“value”:“POWER”},{“property”:“lastname”,“value”:“RANGER”}]}
ranger@bisaerts.be, POWER RANGER : FAILED (HTTP Status = 403)
Access Denied
You don’t have permission to access (URL Here) on this server.
Reference #18.54535d68.1511509121.cd7a024
<<<<< END OF HUBSPOT API RESPONSE >>>
Nov 27, 2017 12:03 PM
Hi @DannyBisaerts,
Can you direct message me the Hapikey you’re using?
Nov 24, 2017 3:05 AM
Additional info:
This is my code snippet:
$url = “https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/$email/?hapikey=$hubspotApiKey”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response=curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
curl_close($ch);