I'm trying to sending a field value to third part but here the issue is

Suppose the filed is Name = "Test Account" here in this case call will be failed but for suppose

Field Name is like Name = "TestAccount" in this case call is giving response as success

Could anyone suggest how to avoid this issue

Request :

HttpResponse[Status=BAD_REQUEST, StatusCode=400]

System.HttpRequest[Endpoint=https://adobeconnect.com/api/xml?action=event-register&sco-id=1629956237&[email protected]&password=test1234&password-verify=test1234&first-name=Srinu&last-name=s&Company=Test Company&session=apac1breezci34y2pfd23eyiaq, Method=POST]

Success response :

System.HttpRequest[Endpoint=https://adobeconnect.com/api/xml?action=event-register&sco-id=1629956237&[email protected]&password=test1234&password-verify=test1234&first-name=Srinu&last-name=s&Company=TestCompany&session=apac1breezci34y2pfd23eyiaq, Method=POST] 09:50:38.13 (956337528)|CALLOUT_RESPONSE|[54]|System.HttpResponse[Status=null, StatusCode=200]

Thanks, Raghu

  • Please edit this question to include specific code and details of the target of the request. If you are calling out to a non-Salesforce third party system, we may not be able to help you.
    – David Reed
    Commented Aug 8, 2019 at 14:04
  • please check the request I have added and see the company name field in two requests
    – Raghu
    Commented Aug 8, 2019 at 14:16

2 Answers 2


If the data are being passed as URL parameters rather than in the body of the HTTP request, you need to encode the request URL to ensure there are no spaces. Without seeing your code for how the request is being built, it's not possible to give exact guidance, but either EncodingUtil.urlEncode() or String.replace(' ','+') if you only have spaces, should work.


You need to URL-Encode the parameters. A space in the actual URL will cause an error (as well as many other non-alphanumeric characters). Use PageReference to build a proper URL:

PageReference ref = new PageReference('https://adobeconnect.com/api/xml');
// ... //
ref.getParameters().put('Company','Test Account');
req.setEndpoint(ref.getUrl()); // Properly encoded URL

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .