Hello,
I have created a filter on organizations using Pipedrive GUI and the filter_id is 51.
I have 400 organizations that are shown using the GUI and applying this filter)
This is my PHP Code.
//Fake API Token
$apiToken = ‘fdsfdsfdssdfsdwerwerwerwerwe’;
$client = new Pipedrive\Client(null, null, null, $apiToken);
$user_id = 51;
$filter_id = 51;
$organizations[] = $client->getOrganizations($user_id,$filter_id);
I need to retrieve the value of ID field for each element found in organizations[].
How can I accomplish this?
I’m not able to extract data from organizations[] array, it seems empty.
Thank you for your help
Regards
Vittorio Cicognani
Hi @Vittorio_Cicognani, welcome to the community 
to be able to use the getOrganizations
function, you’d need to access the organizations API instead of the client.
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'xxx');
$organizationsApi = new Pipedrive\Api\OrganizationsApi(
new GuzzleHttp\Client(),
$config
);
$user_id = 51;
$filter_id = 51;
$result = $organizationsApi->getOrganizations($user_id,$filter_id);
Hello,
Thank you for your answer,
Fatal error : Uncaught Error: Call to undefined method Pipedrive\Configuration::setApiKey()
is what happens now…
How can I include GuzzleHttpClient in my project? Are there some files I have to download?
Remember I was using client
Regards
Vittorio Cicognani
Hello @Vittorio_Cicognani,
can you reveal which version of client-php are you using in Composer? Is it the most recent one 6.1?
The GuzzleHttp\Client
is part of the package (6.1) so it is not needed to include it at all.
$organizationsApi = new Pipedrive\Api\OrganizationsApi(
null,
$config
);