IsraelOrtuno/pipedrive

SearchFromField API

Closed this issue · 3 comments

zang commented

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

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

searchFromField is a method from this class:

/**
* Search from a specific field.
*
* @param $term
* @param $field_type
* @param $field_key
* @param array $options
* @return mixed
*/
public function searchFromField($term, $field_type, $field_key, $options = [])
{
$options = array_merge(compact('term', 'field_type', 'field_key'), $options);
return $this->request->get('field', $options);
}

Not from Deals. So you should be using:

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

$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

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.