Guys,
Any ideas on this. Pre FDK9 I could make a Search API call as follows without any issues. The documentation states the query must be URL encoded.
Now in FDK9 I am using the following template
"searchTickets": {
"schema": {
"method": "GET",
"host": "<%= context.subdomain %>.freshdesk.com",
"path": "/api/v2/search/tickets",
"headers": {
"Authorization": "Basic <%= encode(context.apikey) %>"
},
"query":{
"page": "<%= context.page %>",
"query":"<%= context.queryString %>"
}
}
and I pass the same query value in the context of the invokeTemplate call as follows
client.request.invokeTemplate('searchTickets',{
context:{
apikey,
subdomain,
page:1,
queryString: `group_id:101000123013%20AND%20created_at:%3E'2023-03-24'%20AND%20created_at:%3C'2023-04-14'`
}
})
but I get the following error.
{attempts : 1
errorSource : "APP"
headers : {date: 'Fri, 14 Apr 2023 14:39:25 GMT', content-type: 'application/json; charset=utf-8', transfer-encoding: 'chunked', connection: 'close', status: '400 Bad Request', …}
response : "{\"description\":\"Validation failed\",\"errors\":[{\"field\":\"query\",\"message\":\"Given query is invalid, expected format \\\"keyword:value OPERATOR keyword:'string' 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\"}]}"
The API call with the query works in Postman so I am happy that it the query is not malformed.