Property does not exist


#1

// I am using this code to generate access token and update contact, i am getting access token but when updating contact than getting this error:- {“status”:“error”,“message”:“resource not found”,“correlationId”:“e107b32e-b4f9-4615-9c4d-cc96e563bd10”,“requestId”:“da8609b20c072d5da28041a4f46295be”}

// I am trying to update contact 3911740 app id by using 4088660 app id .

// I have done webhook process so i think api work should also work. let me know what i am doing wrong in code .
$post_json = ‘grant_type=refresh_token&client_id=7703276c-e6d3-4955-a562-82f4039b4a26&client_secret=094da739-f303-4881-bf74-719ba439e549&redirect_uri=http://reconresearch.staging-box.net/&refresh_token=5306f796-8273-438f-ac66-ab27638b8c43’;

$endpoint = ‘https://api.hubapi.com/oauth/v1/token’;
$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_HTTPHEADER, array(‘Content-Type: application/x-www-form-urlencoded;charset=utf-8’));
@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);
$reponse = json_decode($response);
$access_token = $reponse->access_token;
$reponse->refresh_token;

// Update User
$hapikey= get_option(‘hapikey’);
$arr = array(
‘properties’ => array(
array(
‘property’ => ‘firstname’,
‘value’ => ‘tester’
)
)
);
$post_json = json_encode($arr);
$endpoint = ‘https://api.hubapi.com/contacts/v1/contact/vid/18451/profile?hapikey=’.$hapikey;
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
//@curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “PUT”);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $post_json);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’,'Authorization: bearer '.$access_token));
@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);
print_r($response);


#2

@Rahul_Chhlotre so you are using both the Hapikey and the OAuth token in your call? You only need one form of authentication, I’m not sure if that is confusing your app. I would remove the hapikey and see if that helps.


#3

@pmanca yes i did try but same issue i found , for clarification i want to use my developer app authentication token and keys to update , create and all actions on my live app contacts and companies.
Let me know if you need anything from me .


#4

This what error i got when i only use access token :- {“status”:“error”,“message”:“Any of the listed authentication credentials are missing”,“correlationId”:“aaa9bc69-0cf4-4f82-ba37-c27b1499bd98”,“engagement”:{“access_token”:“access_token not engaged. Token not found in query params.”,“shhkey-v1”:“shhkey-v1 not engaged. Shhkey not found in the request header.”,“vendorkey-gae”:“vendorkey-gae not engaged. Vendorkey not found in request headers.”,“oauth-token”:“oauth-token not engaged. OAuth access token not found in request header.”,“hapikey”:“hapikey not engaged. hapikey is not present in query params.”,“internal-cookie”:“internal-cookie not engaged. Cookie not found in the request.”,“app-cookie”:“app-cookie not engaged. App cookie is not present on the request.”,“legacy-app-cookie”:“legacy-app-cookie not engaged. Auth cookie is not present in the request.”,“saml-redirect”:“Not engaged, HubId not specified on the request, cannot identify Identity Provider. is missing”},“requestId”:“30b8dffd3b8f70e7f1fc79862fe056ee”}


#5

@Rahul_Chhlotre You need to use the hapikey or the OAuth token you get from your portal and not your dev portal.