@Emil ```
const http = require('http');
const burstAPI_Key = 'api_key_here';
const burstAPI_Secret = 'API_secret_here;
// Function to encode credentials to Base64 for Basic Authentication
function base64Encode(str) {
return Buffer.from(str).toString('base64');
}
// Forming the Authorization header
const authHeader = 'Basic ' + base64Encode(burstAPI_Key + ':' + burstAPI_Secret);
// Making the HTTP request
function checkSmsBurstApi() {
http.makeRequest({
url: 'https://api.transmitsms.com/get-lists.json',
method: 'GET',
headers: {
"Authorization": authHeader
}
}, function(err, res) {
if (err) {
console.error("An error occurred:", err);
} else {
console.log("Response status code:", res.statusCode);
// Optionally, log the response body or headers here for more information
}
});
}
// Execute the function to check the API
checkSmsBurstApi();
The above code results in this error:
TypeError: undefined not callable (property 'from' of [object Function])
at [anon] (duk_js_call.c:2917) internal
at base64Encode (root/basicBurstSMSTest/main.js:8)
at [anon] (root/basicBurstSMSTest/main.js:12)
at require (init.js:131)
at [anon] (init.js:139) preventsyield
at runInit () native strict preventsyield
at handlePacket (pipe_communication.js:48)
at readCallback (pipe_communication.js:93) preventsyield
Thanks for the ongoing support.