Migration Issue in (request.js)

We have developed our application by integrating amazon connect and freshdesk in FDK 8. Therefore, we are updating our application to FDK 9, as we are facing some issues while updating the application.
For example, after creating the request.js file in the query field we have to pass two query parameters, but we are getting a error.

sample code:
“checkContactInfoByPhoneNumber”:{
“schema”: {
“protocol”: “https”,
“method”: “GET”,
“host”:“<%= context.domain >”,
“path”: “/api/v2/search/contacts”,
“headers”: {
“Authorization”:“Basic <= encode(iparam.freshdesk_apiKey) >”,
“Content-Type”: “application/json”
},
“query”: {
“query”: " ‘phone:<= context.phone_Number > OR mobile:<= context.phone_Number %>’"
}
}
}

The error occurs when attempting to include two query parameters within the query field.

Could you please provide guidance on rectifying this issue?

@Freddy your thoughts about this issue?

Hello Gopi, it seems like the issue is related to the format of the query parameter. You need to pass two query parameters, but the current code has only one query parameter with a combined string. To rectify this issue, you should separate the two query parameters and their corresponding values in the request.js file.

Here’s an updated version of the “checkContactInfoByPhoneNumber” object with separate query parameters:

"checkContactInfoByPhoneNumber": {
  "schema": {
    "protocol": "https",
    "method": "GET",
    "host": "<%= context.domain %>",
    "path": "/api/v2/search/contacts",
    "headers": {
      "Authorization": "Basic <= encode(iparam.freshdesk_apiKey) >",
      "Content-Type": "application/json"
    },
    "query": {
      "phone": "<= context.phone_Number >",
      "mobile": "<= context.phone_Number %>"
    }
  }
}

Please note that this example assumes the API endpoint accepts the query parameters ‘phone’ and ‘mobile’ directly. If the endpoint requires a different format, please adjust the query parameters accordingly.

Hi,

I have tried the code which you have sent, but i am getting the same error message.

Hi @bala,

Could you try if it works?

Hi @Raviraj,

I am getting error while executing encodeURIComponent. I also attached a screenshot for your reference.

@bala, are you encoding the URI before passing the context or directly using it in the Request Schema? The latter will not work.
Could you share the request scheme and where it’s invoked with the latest syntax?

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