pipedrive / client-php

Pipedrive API client for PHP
MIT License
48 stars 55 forks source link

"getDetailsOfADeal" doesn't contain Deal Custom Fields in response #70

Closed takka closed 2 years ago

takka commented 2 years ago

Hello! I am trying to connect my project to PipeDrive and decided to use this php client, but I have some issues. "getDetailsOfADeal" doesn't return custom fields, direct API call response has them in "data", but when I use this client, $response ->data contains only default set of fields.

Checked all the documentation I could, but still cannot find the answer, is there any way to get deal custom field value via this client?

SpaceOven commented 2 years ago

Hi! What version of the client are you using? I tried here with the latest one (4.0.2), it seems to be working. Here is my code snippet:

<?php

require_once __DIR__.'/../vendor/autoload.php';

session_start();

$apiToken = '<REPLACE WITH API TOKEN>';
$dealId = <REPLACE WITH DEAL ID>;

$client = new Pipedrive\Client(null, null, null, $apiToken); 

try {
     echo '<div><h2>Get one deal with custom fields</h2><div>';
     $response = $client->getDeals()->getDetailsOfADeal($dealId);

     echo '<pre>';
     var_dump(json_encode($response->data, JSON_PRETTY_PRINT));
     echo '</pre>';

} catch (\Pipedrive\APIException $e) {
    echo $e;
}

It brings my custom field: image