Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Errors when Filtering for Companies #21

Open
nschiffelbein opened this issue Jul 29, 2018 · 1 comment
Open

API Errors when Filtering for Companies #21

nschiffelbein opened this issue Jul 29, 2018 · 1 comment

Comments

@nschiffelbein
Copy link

I'm guessing this is an encoding issue, but I haven't been able to correct it as of yet. When using the filtering capabilities documented in the Freshdesk API for searching companies by domain I receive the following error: "Unexpected/invalid field in request"

After some testing I was able to get the following curl request to work from the command line, but I can't reproduce the same result in code.

curl -v -u {API_KEY}:X -X GET 'https://{DOMAIN}.freshdesk.com/api/v2/search/companies?query="domain:%27gmail.com%27"'

The key seems to be encoding the single quotes in the query, but not the double quotes surrounding it, at least from the curl CLI. I tried a number of combinations from the PHP library and can't seem to get it to go through.

$arrCompanies = $this->objFreshdesk->companies->all([
'query' => '"domain:'gmail.com'"',
]);

@christoph-werker
Copy link

try $api->tickets->search("status:2"); for companies.

This should work. But i don't figure out, hot to paginate now.
It should look like this:

curl -v -u APIKEY:X -X GET 'https://URL/api/v2/search/tickets?query="status:3%20OR%20status:4"&page=2'

Source:

public function search(string $filtersQuery)
    {
        $end = '/search' . $this->endpoint();
        $query = [
            'query' => '"' . $filtersQuery . '"',
        ];
        return $this->api()->request('GET', $end, null, $query);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants