I have this code

String endpoint = 'https://url.here.com/path/stuff/here';
String username = 'username';
String password = 'password';

HttpRequest req = new HttpRequest();
 req.setEndpoint( endpoint );
payload =     '{' +
'  "properties": {' +
'    "xmatters_url": "xmatters_url",' +
'    "Incident Number": "Incident Number",' +
'    "Last Name": "Last Name",' +
'    "Due Date": "Due Date",' +
'    "Outage Start": "Outage Start",' +
'    "Outage End": "Outage End",' +
'    "Owner": "Owner"' +
'  },' +
'  "recipients": [{' +
'    "targetName": "Hardware"' +
'  }]' +

 req.setBody( payload );

 Blob headerValue = Blob.valueOf( username + ':' + password );
 String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode( headerValue );
 req.setHeader('Authorization', authorizationHeader);

 // Create a new http object to send the request object
 // A response object is generated as a result of the request  

 Http http = new Http();
 HTTPResponse res = http.send(req);

However, when I run this in the developer console, I am seeing this:

21:14:19:150 CALLOUT_RESPONSE [47]|System.HttpResponse[Status=Could not find resource for relative : path/stuff/here of full path: http://url.here.com/path/stuff/here, StatusCode=404]

Note the "http', not 'https'. I can reproduce the same behavior with my REST client when I send it to the http://url.here.com/path/stuff/here instead of the https://url.here.com/path/stuff/here

Is there something special I have to do to force it to https?

  • This is because of lack SSLv3 support on the remote server. Salesforce is disabling support for SSLv3 over the next few weeks. TLS will be the only supported secure protocol as of December 15th.
    – sfdcfox
    Nov 18, 2014 at 4:36
  • "on the remote server", can you clarify? I'm making a call from APEX to a non SF server, so is this still applicable? And how would I change this APEX code to use TLS instead of SSL? I was under the impression that was all network level stuff and abstracted by the APEX http library? Nov 19, 2014 at 18:03
  • Well, looks like you are right But the date on that says Dec 3 for Sandbox and Dec 10 for Production for Callout Integrations.... neither date has passed yet, so I suspect something else at play here. I also verified the remote site accepting my request is using TLS 1.2 Nov 19, 2014 at 20:31
  • Oh. Wrong date. But I knew it was early-mid December something. Trust me, lots of people are anxiously awaiting the fix.
    – sfdcfox
    Nov 19, 2014 at 20:34

1 Answer 1


Weird, I realized I was missing a header needed for the remote service. We're good here.

  • You should mark this answer as accepted so the Community doesn't continue to ping it.
    – Adrian Larson
    May 18, 2016 at 1:08

You must log in to answer this question.

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