Network API HTTP/s block - Response header data?

Hi Tim,

It is possible with custom JS code injected into the logic. Here’s an example:
UI Builder - ConsoleDemo - Backendless 2022-06-16 14-17-30

The Custom Code block has the following:

var request = new XMLHttpRequest();

return new Promise(function(resolve, reject) {
  var headerMap = {};
  request.open("GET", "https://quotes.rest/qod?language=en", true);
      
  request.onreadystatechange = function() {
    if (request.readyState == this.DONE) {
      console.log( request.status);
        if (request.status >= 200 && request.status < 300) {
          resolve({responseText:request.responseText, headers:headerMap});
        } 
        else {
          reject("Error, status code = " + request.status)
        }
    }
    
    if(this.readyState == this.HEADERS_RECEIVED) {
  
      // Get the raw header string
      var headers = request.getAllResponseHeaders();
  
      // Convert the header string into an array
      // of individual headers
      var arr = headers.trim().split(/[\r\n]+/);
  
      // Create a map of header names to values
  
      arr.forEach(function (line) {
        var parts = line.split(': ');
        var header = parts.shift();
        var value = parts.join(': ');
        headerMap[header] = value;
      });
    }
  }
  request.send();
})

Make sure to select return result:

The sample code above runs a GET operation. You’d need to modify the code to use the URL of your external service with the required request headers and body.

Regards,
Mark