SECURE_CONNECTION_REQUIRED error pops up when using Communications.makeWebRequest()

Former Member
Former Member

I am trying to access a public HTTPS API using makeWebRequest(). Here is the code:

Communications.makeWebRequest(
	myAPI,
	{
	},
	{
		:method => Communications.HTTP_REQUEST_METHOD_GET,
		:header => {"Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON},
		:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
	},
    method(:onReceive)
);

myAPI is an "https://" online API.

The code inside onReceive is this:

function onReceive(responseCode, data) {
	System.println(responseCode);
    System.println(data);
}

this ends up printing:

-1001

null

How do I get it to work?