Hubspot account is 5664924.
My integration uses products API (https://api.hubapi.com/crm-objects/v1/objects/products/) to create ids associated with specific products, so they could then be added as line items to deal. Prior to this week, I was using API key authentication method and it worked great. However, this week I saw that API keys will be retired and switched to private app method. After that it stopped working. It simply returns me “Error 500 Request failed” error whenever I send a request to the URL.
The request I am trying to send:
url: https://api.hubapi.com/crm-objects/v1/objects/products/
http_headers:
Authorization: Bearer XXXXXXXXXXXXXXXXXXX
Content-Type: application/json
method: post
post data: [{“name”:“name”,“value”:“BUNWTBTWTN”},{“name”:“description”,“value”:“Universal Faux Stone Window and Door Trim”},{“name”:“price”,“value”:“33.0000”}]
Sample PHP code with private app (not working, gives 500 error):
$ch = curl_init(‘https://api.hubapi.com/crm-objects/v1/objects/products/’);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘[{“name”:“name”,“value”:“BUNWTBTWTN”},{“name”:“description”,“value”:“Universal Faux Stone Window and Door Trim”},{“name”:“price”,“value”:“33.0000”}]’);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Authorization: Bearer XXXXXXXXXXXXXXXXXXX’, ‘Content-Type: application/json’) );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close ($ch);
var_dump($response);
Then a working example with hapikey:
$ch = curl_init(‘https://api.hubapi.com/crm-objects/v1/objects/products/?hapikey=YYYYYYYYYYYYYYYYYYYYYY’);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘[{“name”:“name”,“value”:“BUNWTBTWTN”},{“name”:“description”,“value”:“Universal Faux Stone Window and Door Trim”},{“name”:“price”,“value”:“33.0000”}]’);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’) );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close ($ch);
var_dump($response);
Upon digging into this, I noticed that within Scopes settings of private app there is no scope for “products” (it is simply missing) in all sections (CMS, CRM, Settings, Standard). Authorization header is correct and works for other scopes. So my asumption is that the error is due to missing scope.
But how do I communicate with products API then?

