Filter v1 x Search V2 MINT


Hi for all....


I am having problems using the search
in v2 ... mainly in custom fields ... for example, I used the
ticked_fields api to get the list of fields ... ok ... now the name of
my field that I want to filter is os_apigts ... then the curl command
would look like:


curl -v -u moser@softdata.com.br:pass -H "Content-Type: application/json" -X GET 
'https://softdatabr.freshdesk.com/api/v2/search/tickets?query="os_apigts:10586"'

But it does not work ... what am I doing wrong?



This topic has been closed for comments

7 replies

Userlevel 4
Badge +12

Hello Willian,


Can you please try the following command and see if that works? 


curl -v -u email:password -H "Content-Type:application/json" -X GET 'https://softdatabr.freshdesk.com/api/v2/search/tickets?query="os_apigts:10586"'


Cheers!

Tks Aravind,


But not work for me...see..


T:\Lixo\curl-7.46.0-win64\bin>curl -v -u email:pass -H "Content-Type:application/json" -X GET 'https://softdatabr.freshdesk.com/api/v2/search/tickets?query="os_apigts:10586"'
Note: Unnecessary use of -X or --request, GET is already inferred.
* Protocol "'https" not supported or disabled in libcurl
* Closing connection -1
curl: (1) Protocol "'https" not supported or disabled in libcurl


However if you excute in this way the result is already different but even then the command is not executed, see bellow:


> Accept: */*
> Content-Type:application/json
>
< HTTP/1.1 400 Bad Request
< Cache-Control: must-revalidate, no-cache, no-store, private, max-age=0
< Content-Type: application/json; charset=utf-8
< Date: Wed, 04 Jul 2018 13:33:18 GMT
< Expires: Wed, 13 Oct 2010 00:00:00 UTC
< Pragma: no-cache
< Set-Cookie: _x_w=10; path=/; secure
< Status: 400 Bad Request
< X-Freshdesk-API-Version: latest=v2; requested=v2
< X-Rack-Cache: miss
< X-RateLimit-Remaining: 2998
< X-RateLimit-Total: 3000
< X-RateLimit-Used-CurrentRequest: 1
< X-Request-Id: 6fbba7ce09e9359277dd391f9f6d9b69
< X-XSS-Protection: 1; mode=block
< Content-Length: 345
< Connection: keep-alive
<
{"description":"Validation failed","errors":[{"field":"query","message":"Given query is invalid, expected format \"keyword:value  OPERATOR keyword:'string' OPERATOR keyword:>'yyyy-mm-dd' OPERATOR keyword:<integer\". Space is mandatory between key/value pair and operator. Please check the paranthesis if there are any.","code":"invalid_value"}]}* Connection #0 to host softdatabr.freshdesk.com left intact


Best Regards,





Userlevel 4
Badge +12

Willian,


The query used in your command seems to be legit and I'm really not sure on why you're getting the error. Can you try some other client, maybe POSTMAN and see if this works?


'https://softdatabr.freshdesk.com/api/v2/search/tickets?query="os_apigts:10586"'


Cheers!

Getting the same error message.

Any resolution on this?

Found out:


You will need to escape the doble quotes AND use them instead of the single quotes to wrap the destination like follows



"https://softdatabr.freshdesk.com/api/v2/search/tickets?query=\"os_apigts:10586\""


any update on this issue? i'm having the same issue. hope this can be resolved as soon as possible.


in my case, number type works fine -> query="cf_code:20", but for string type it does not work -> query="cf_property:'wales'"