Oct 12, 2022 12:04 PM
In our existing API Key setup, we have these URLs to determine if we need to do an ADD or an UPDATE based on a match on the vid:
https://api.hubapi.com/contacts/v1/contact/vid/XXXX/profile?hapikey=XXXX;
How would I accomplish the same in the Private App setup, which references v3?
https://api.hubapi.com/crm/v3/objects/contacts
Thank you!
Solved! Go to Solution.
Oct 13, 2022 4:18 PM - edited Oct 13, 2022 4:19 PM
Thanks for the reply—I think for developers more experienced, your response likely was a helpful solution.
Let me try to simplify my noob question:
Since I'm adding the access_token to the header with `Authorization: Bearer`, can I simply remove the hapikey param from these existing links, turning this:
$url = 'https://api.hubapi.com/contacts/v1/contact?hapikey=' . $api_key;
into
$url = 'https://api.hubapi.com/contacts/v1/contact';
(in essence, leaving the rest of the implementation in place, since after passing the access_token in the headers, that handles the authentication?)
Again, sorry if these are super basic questions!
Oct 14, 2022 2:18 AM
Hey @MJProvencher
Yes, you can remove hapikey param from these existing links as these will be of no use from 1 December 2022 according to new privacy & policy changes of hubspot. All endpoints will rely on Private Apps that are the Authorization Bearer tokens.
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.
Oct 13, 2022 5:06 AM - edited Oct 13, 2022 5:07 AM
Hey @MJProvencher
Hey there it feels like you still need rely on V1
Still you can have a look at the below link - >
Regarding the migration ->
Check the contact scopes from here ->
https://developers.hubspot.com/docs/api/crm/contacts
Check the below image ->
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.
Oct 13, 2022 4:18 PM - edited Oct 13, 2022 4:19 PM
Thanks for the reply—I think for developers more experienced, your response likely was a helpful solution.
Let me try to simplify my noob question:
Since I'm adding the access_token to the header with `Authorization: Bearer`, can I simply remove the hapikey param from these existing links, turning this:
$url = 'https://api.hubapi.com/contacts/v1/contact?hapikey=' . $api_key;
into
$url = 'https://api.hubapi.com/contacts/v1/contact';
(in essence, leaving the rest of the implementation in place, since after passing the access_token in the headers, that handles the authentication?)
Again, sorry if these are super basic questions!
Oct 14, 2022 2:18 AM
Hey @MJProvencher
Yes, you can remove hapikey param from these existing links as these will be of no use from 1 December 2022 according to new privacy & policy changes of hubspot. All endpoints will rely on Private Apps that are the Authorization Bearer tokens.
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.
Nov 18, 2022 2:13 PM
In case it helps, this is a summary of what I needed to do:
define('HS_PRIVATE_APP_TOKEN', 'XXXXXX'); // added
$header = array(
'Content-Type: application/json', // existing
'Accept: application/json', // existing
'Authorization: Bearer ' . HS_PRIVATE_APP_TOKEN // needed to be added everywhere
);
// removed the following:
// $url = 'https://api.hubapi.com/companies/v2/companies/paged?hapikey='.$api_key.$properties.'&limit=200'.$hs_offset;
// added this modified declaration, removing the $api_key param
$url = 'https://api.hubapi.com/companies/v2/companies/paged?limit=200'.$properties.$hs_offset;
// and this was existing as well
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);