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 );
req.setMethod('POST');
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);
System.debug(res.getBody());
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?