SSJS offers three different ways to make HTTP requests. Choose based on how much control you need:

API Control Level Best For
Platform.Function.HTTPGet / Platform.Function.HTTPPost Basic Simple GET/POST; response body only; without Core load
HTTP.Get / HTTP.Post (Core) Medium Same transport as syndicated HTTP docs — returns a status + body object
Script.Util.HttpGet Full-ish Shorthand for Script.Util.HttpRequest with GET method but without control over timeouts and returned encoding/content-type
Script.Util.HttpRequest Full Custom methods, headers, auth, timeouts, status codes and returns most details

Quick Comparison

// 1. Platform.Function — simplest, body string
var body = Platform.Function.HTTPGet("https://api.example.com/data");

// 2. Core HTTP — object with status + Content (requires Platform.Load)
Platform.Load("core", "1.1.5");
var response = HTTP.Get("https://api.example.com/data");
Write(Stringify(response));

// 3. Script.Util.HttpRequest — full control
var req = new Script.Util.HttpRequest("https://api.example.com/data");
req.method = "GET";
req.setHeader("Authorization", "Bearer " + token);
var resp = req.send();
Write("Status: " + resp.statusCode + ", Body: " + String(resp.content));

Authentication Patterns

Bearer Token

var req = new Script.Util.HttpRequest("https://api.example.com/resource");
req.method = "GET";
req.setHeader("Authorization", "Bearer " + accessToken);
req.setHeader("Accept", "application/json");
var resp = req.send();
var data = Platform.Function.ParseJSON(String(resp.content));

Basic Auth

Core SSJS does not expose Platform.Function.Base64Encode. Build a Basic token outside the runtime (secret store, token service) or derive it via AMPscript inside TreatAsContent, then pass the finished Authorization: Basic … header:

var req = new Script.Util.HttpRequest("https://api.example.com/resource");
req.method = "GET";
req.setHeader("Authorization", "Basic " + basicCredentialsFromSecureStorage);
var resp = req.send();

SFMC REST API OAuth2

// Step 1: Get access token
var authPayload = Stringify({
    grant_type: "client_credentials",
    client_id: clientId,
    client_secret: clientSecret
});
var authResp = Platform.Function.HTTPPost(
    authEndpoint,
    "application/json",
    authPayload
);
var token = Platform.Function.ParseJSON(authResp + "").access_token;

// Step 2: Call API with token
var req = new Script.Util.HttpRequest("https://mc.rest.api.example.com/v2/contacts");
req.method = "GET";
req.setHeader("Authorization", "Bearer " + token);
var resp = req.send();
var contacts = Platform.Function.ParseJSON(String(resp.content));