Access Denied 403 when trying to create/update contact information

contacts

#1

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 >>>


#2

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);

#3

Hi @DannyBisaerts,

Can you direct message me the Hapikey you’re using?