The Platform namespace exposes a set of objects beyond Platform.Function.* that give you direct control over the execution environment. These are available without loading the Core library.

Objects in this Section

Object Description
Platform.Load Load SSJS library namespaces (Core, etc.)
Platform.Variable Read and write AMPscript variables
Platform.Response Control HTTP response (status, redirect, content-type)
Platform.Request Read HTTP request data (query string, POST, headers, cookies)
Platform.Recipient Read subscriber attributes and sendable DE fields for the current recipient
HTTPHeader Core-library helpers for HTTP headers (requires Core load)
DateTime.TimeZone Retrieve time zone definitions (requires Core load)
ErrorUtil Throw on WSProxy error status (requires Core load)

Platform.Load

Before using the Core library (DataExtension, Subscriber, HTTP, etc.), you must call:

Platform.Load("core", "1.1.5");

This must appear at the top of your script block, before any Core library calls. See Platform.Load for details on available libraries and version numbers.


Platform.Variable

The AMPscript–SSJS variable bridge. Read and write AMPscript variables from SSJS:

var email = Platform.Variable.GetValue("@email");
Platform.Variable.SetValue("@result", "processed");

Platform.Request

Read everything about the incoming HTTP request:

var method = Platform.Request.Method;                        // "GET" or "POST"
var q = Platform.Request.GetQueryStringParameter("q");       // URL query param
var body = Platform.Request.GetPostData();                   // raw POST body
var header = Platform.Request.GetRequestHeader("X-Token");  // request header
var cookie = Platform.Request.GetCookieValue("sessionId");  // cookie value

Platform.Response

Control the HTTP response before output is sent:

Platform.Response.ContentType = "application/json";
Platform.Response.Redirect("https://example.com", false);