La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
le déc. 15, 20219:21 AM - dernière modification le déc. 15, 20215:44 PM par dennisedson
Participant
PHP Updating Line Item Results in 403 Forbidden
I'm writing a couple PHP functions to create and/or modify a deal's line item. Everything is working great except for the /crm/v3/objects/line_items/ endpoint.
My PHP code is direct from the successful test call that was generated in the endpoint documentation
require('app-top.php');
use HubSpot\Factory;
use HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\LineItems\ApiException;
$client = Factory::createWithApiKey(HUBSPOT_API_KEY);
$properties = [
"price" => "123.00"
];
$SimplePublicObjectInput = new SimplePublicObjectInput(['properties' => $properties]);
try {
$apiResponse = $client->crm()->lineItems()->basicApi()->update($SimplePublicObjectInput, "2388052385", null);
var_dump($apiResponse);
} catch (ApiException $e) {
echo "Exception when calling basic_api->update: ", $e->getMessage();
}
This code returns a 403 Forbidden error. The exact error code is:
Exception when calling basic_api->update: [403] Client error: `PATCH https://api.hubapi.com/crm/v3/objects/line_items/%7B%0A%20%20%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22price%22%3A%20%22123.00%22%0A%20%20%20%20%7D%0A%7D?hapikey=xxxxx` resulted in a `403 Forbidden` response:
It appears to be a message from Cloudflare. My IP address is not blocked (because all of my other API calls work OK). I'm thinking that maybe Cloudflare sees something wrong with the format of the data. I think this is the only PATCH call that I am using. Maybe there is an issue with that? I'm not sure. Any ideas? code working in the endpoint documentation test call