Lumen help

Constructing an API signature

Signature process

Signature format

Unauthenticated requests

Or, use Postman

                var moment = require("moment");
/*  Variables need to be added for KEY_ID and SECRET.  Values should be entered as
    Current Values so they will not be exported.  API Keys are created in the Lumen
    Media Portal.
*/
var keyId = pm.variables.get("KEY_ID");
var secret = pm.variables.get("SECRET");

/*
    URL Variables need to be replaced in the signature string
*/
var requestURI = "";
for (i = 0; i < pm.request.url.path.length; i++) {
    var uriPart = pm.request.url.path[i];
    if (uriPart.startsWith("{{") && uriPart.endsWith("}}")) {
        uriPart = uriPart.substring(2, uriPart.length - 2);
        uriPart = pm.variables.get(uriPart);
    }
    requestURI += "/" + uriPart;
}

var requestMethod = pm.request.method;

/*
    PLEASE NOTE THAT CONTENT-TYPE HEADER MUST BE EXPLICITLY SET (DUPLICATED) WHEN SENDING
    A REQUEST WITH BODY (POST,PUT).  OTHERWISE POSTMAN WILL NOT ADD CONTENT-TYPE HEADER
    UNTIL AFTER THIS SCRIPT HAS EXECUTED AND REQUESTS WILL FAIL
*/
var contentType = pm.request.headers.get("Content-Type");
if (!contentType)
    contentType = "";

var md5 = "";
if (pm.request.body) {
    md5 = CryptoJS.MD5(pm.request.body).toString();
}
console.log("md5: " + md5);

var formattedDateString = moment().utc().format('ddd, D MMM yyyy HH:mm:ss') + ' GMT';
var stringToSign  = formattedDateString + '\n' + 
                    requestURI + '\n' +
                    contentType + '\n' +
                    requestMethod + '\n' +
                    md5;
console.log("stringToSign: " + stringToSign);

var stringToSignUtf8 = CryptoJS.enc.Utf8.parse(stringToSign);
var secretUtf8 = CryptoJS.enc.Utf8.parse(secret);
var hmac = CryptoJS.HmacSHA512(stringToSignUtf8,secretUtf8);
var hmacBase64String = CryptoJS.enc.Base64.stringify(hmac);
var authHeaderValue = "MPA " + keyId + ":" + hmacBase64String;

pm.request.headers.add({key: "Authorization", value: authHeaderValue});
pm.request.headers.add({key: "x-l3-date", value: formattedDateString});
pm.request.headers.add({key: "Content-MD5", value: md5});