+ Start a Discussion
Arjun y 7Arjun y 7 

Need to include single quotes in endpoint url

Hi All,

I need to include quotes into the below url. can anyone please help me to solve this.

String i = 'https://test.dev.com?id='1234'';

I need to send that in endpoint url as request.setendpoint(i). While i am doing in this process, single quotes are ,missing in endpoint url.


Naval Sharma4Naval Sharma4
Hi Arjun,

You have to use URLEncode method. Here is the code.
String i = 'https://test.dev.com?id=\'1234\'';
String encoded = EncodingUtil.urlEncode(i, 'UTF-8');