Freshdesk API (Filtering Ticket by Status of the ticket) returns 400 for "Unexpected/invalid field in request"

I am attempting to create Full-Page App on Freshdesk. Its primary functionality is to render a bar graph depicting ticket counts based on their status. When I try to filter using status it is throwing {\"description\":\"Validation failed\",\"errors\":[{\"field\":\"status\",\"message\":\"Unexpected/invalid field in request\",\"code\":\"invalid_field\"}]}

Here I am including the manifest.json, requests.json and app.js code
manifest.json

"platform-version": "2.3",
  "product": {
    "freshdesk": {
      "location": {
        "full_page_app": {
          "url": "index.html",
          "icon": "styles/images/icon.svg"
        }
      },
      "requests" : {
        "getTickets": {}
      }
    }
  },
  "engines": {
    "node": "18.0.0",
    "fdk": "9.0.3"
  }
}

requests.json

{
    "getTickets": {
        "schema": {
            "method": "GET",
            "host": "<%= iparam.freshdesk_subdomain %>.freshdesk.com",
            "path": "/api/v2/search/tickets",
            "headers": {
                "Authorization": "Basic <%= encode(iparam.freshdesk_api_key) %>",
                "Content-Type": "application/json"
            },
            "query": {
                "status": "<%= context.status %>"
            }
        },
        "options": {
            "retryDelay": 1000            
        }
    }
}

app.js

let getData = await client.request.invokeTemplate("getTickets",{
        "context" : {
          "status" : 2
        }
      })

Error I am getting : {\"description\":\"Validation failed\",\"errors\":[{\"field\":\"status\",\"message\":\"Unexpected/invalid field in request\",\"code\":\"invalid_field\"}]}

Can any one please let me know what I am missing?

The error could be due to the use of the query key which refers to the Query parameters.

The expected endpoint is something like this:
/api/v2/search/tickets?query=“status:2”

then try:

"query": {
                "query": "status:<%= context.status %>"
            }

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.