Invalid URL - Must be FQDN

Hi Team,

Occasionally, we are getting the following error in getting list of agents API, " Invalid URL - Must be FQDN". and used this API in both ticket sidebar and full page app but we are facing this issue only on full page app,

I have shared the following screenshot,

image

Thank you,
Thayammal P

Hi @Thayammal1,

Greetings!

Have you tried making the API call in Postman? Does it work there?

It looks like there might be an issue with the body you’re passing in the request. Could you please share a snippet showing how you’ve configured the request template and the data being passed? That would help us debug further.

Thanks,
Anish

Hi @Anish,

Yes, I tried the agents list API in postman and it works fine. Please find the required code snippets below,

request.json

  "getAgents": {
        "schema": {
            "method": "GET",
            "host": "<%= iparam.domainName %>",
            "path": "/api/v2/agents",
            "protocol":"https",
            "headers": {
                "Authorization": "Basic <%= encode(iparam.api_key) %>",
                "Content-Type": "application/json"
            },
            "query": {
                "page": "<%= context.page %>" ,
                "per_page": "100"
            }
        },
        "options": {
            "retryDelay": 1000,
            "isOAuth": false
        }
    },

and the functionality is the following,

async function getagent(page1=1, agentsArray = []) {
    const body = await window.client.request.invokeTemplate("getAgents", {
      context: {
        page: page1
      }
    });
    if (body) {
      let results = JSON.parse(body.response);
      results = results.agents;
      if (page1 == 10 || results.length == 0) {
        return agentsArray;
      } else {
        let pg = page1;
        pg += 1;
        agentsArray.push(...results);
        return getagent(pg, agentsArray);
      }
    }

}

and this is a common function for both ticket sidebar files and dashboard file but it works fine for ticket sidebar app and not in dashboard page app.

Thank you,
Thayammal P.

@Thayammal1 This error appears when the API request is made with a non-standard domain or a missing domain in the URL.

Since you have used the iparam template, as long as the iparam is available when this API request is invoked and it has proper value as expected, this error will not occur.

  1. Could you confirm if the domainName is a proper value?
  2. Does the iparam have the protocol and no trailing slash?
  3. Is the API request function called after the app is completely loaded? It should be called inside the onAppActivated lifecycle event.
  4. Is this issue happening in local testing or as a custom app or both?
  5. Could you hard-code the value for the domain and test if it works fine? If so, could you narrow down in which case defining the template fails?

Hi @Raviraj ,

This issue happening only on custom app and i also checked the domainName value and the API except the case 3, (i.e) the API call is not within the onAppActivated lifecycle event.

I will try to check the API call inside the onAppActivated lifecycle event.

Thank you,
Thayammal P

Hi @Thayammal1,

Please check all the above-mentioned cases. If it still occasionally fails, please raise a support ticket with the app ID and the timestamp of the issue occurrence and our team can troubleshoot if there’s any issue on our platform.

Thank you!

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