var https = require('follow-redirects').https; var fs = require('fs'); var options = { 'method': 'POST', 'hostname': 'api.swep.net', 'path': '/calculateSinglePhase', 'headers': { 'X-API-KEY': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, 'maxRedirects': 20 }; var req = https.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function (chunk) { var body = Buffer.concat(chunks); console.log(body.toString()); }); res.on("error", function (error) { console.error(error); }); }); var postData = JSON.stringify({ "inputs": { "calculationMethod": "Design", "selectedFluidSide1": { "fluidId": 53, "isGas": false, "inputValue": null }, "selectedFluidSide2": { "fluidId": 53, "isGas": false, "inputValue": null }, "coCurrent": false, "selectedHeatExchangers": [ { "heatExchangerInputType": "Parent", "id": 1 } ], "heatLoad": { "amount": 1500, "unit": "HeatLoadUnit.Kilowatt" }, "inletTemperatureSide1": { "amount": 80, "unit": "TemperatureUnit.DegreeCelsius" }, "inletTemperatureSide2": { "amount": 20, "unit": "TemperatureUnit.DegreeCelsius" }, "outletTemperatureSide1": { "amount": 40, "unit": "TemperatureUnit.DegreeCelsius" }, "outletTemperatureSide2": { "amount": 50, "unit": "TemperatureUnit.DegreeCelsius" }, "flowSide1": null, "flowSide2": null, "maxPressureDropSide1": { "amount": 20000, "unit": "PressureUnit.Pascal" }, "maxPressureDropSide2": { "amount": 20000, "unit": "PressureUnit.Pascal" }, "numberOfPasses": null, "numberOfPlates": null, "numberOfPlatesStack1": null, "numberOfPlatesStack2": null, "oversurface": null, "portSwitch": true, "autoperformance": false } }); req.write(postData); req.end();