How to find an account with a name includes special characters via API

Hi,
I used an API to search by account name in Freshsales, but if the name has special characters(eg: Integrated Family & Youth Services - IFYS) it is returning a response array with length 0.
Here is the API I used
https://${domain}/api/lookup?q=${company_name}&f=name&entities=sales_account
Is there any way to avoid this and return exact response.

Thanks in advance,
Soujanya.

Hi @soujanya ,

Just curious, have you tried encoding the URI component like in the following snippet?

let sdomain = `<subdomain>`;
let query = encodeURIComponent("Integrated Family & Youth Services - IFYS");
let url = `https://${sdomain}.freshsales.io/api/lookup?q=` + query + `&f=name&entities=sales_account`;
let opt = {
    headers: {
        'Authorization': 'Token token=<apikey>'
    }
};
client.request.get(url, opt).then(function(data) {
    console.info(data);
});

Usually, this would return the proper result

3 Likes