IsraelOrtuno / pipedrive

Complete Pipedrive API client for PHP
MIT License
166 stars 58 forks source link

SearchFromField API #30

Closed zang closed 7 years ago

zang commented 7 years ago

The results from the following function returns NULL. Any idea? thanks

$pipedrive->deals->searchFromField("Search Term", "Text", "title");

IsraelOrtuno commented 7 years ago

searchFromField is a method from this class:

https://github.com/IsraelOrtuno/pipedrive/blob/293e7d608b7e9a70152db53ea1a8b091dae1a688/src/Resources/SearchResults.php#L31-L45

Not from Deals. So you should be using:

$pipedrive->searchResults->searchFromField(...);
zang commented 7 years ago

$response = $pipedrive->searchResults->searchFromField($test_term, "text", "title"); //tried both text and Text but got the same errors as shown below

PHP Fatal error: Uncaught exception 'Devio\Pipedrive\Exceptions\PipedriveException' with message 'Field_type not supported.' in /home/project/devio/pipedrive/src/Http/Request.php:85\nStack trace:\n#0 /home/project/devio/pipedrive/src/Http/Request.php(62): Devio\Pipedrive\Http\Request->handleResponse(Object(Devio\Pipedrive\Http\Response))\n#1 /home/project/devio/pipedrive/src/Http/Request.php(47): Devio\Pipedrive\Http\Request->executeRequest('get', 'searchResults/f...', Array)\n#2 /home/project/devio/pipedrive/src/Http/Request.php(128): Devio\Pipedrive\Http\Request->performRequest('get', 'field', Array)\n#3 /home/project/devio/pipedrive/src/Resources/SearchResults.php(44): Devio\Pipedrive\Http\Request->__call('get', Array)\n#4 /home/project/devio/pipedrive/src/Resources/SearchResults.php(44): Devio\Pipedrive\Http\Request->get('field', Array)\n#5

IsraelOrtuno commented 7 years ago

If you go to the API documentation, you can see that you hage to specify one of these in the field_type parameter:

screen shot 2017-09-26 at 10 23 22

Plus any other option you wish.