This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SBM ModScript REST API Post Example

Does anybody have good ModScript example of using a Rest API for external app or website.  For example the following javascript code using XMLHttpRequest.  

var data = "String";
var URL = "https:\\websiteurl.com"
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange"function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST""URL");
xhr.setRequestHeader("Accept""application/json");
xhr.setRequestHeader("Content-type""application/x-www-form-urlencoded");

xhr.send(data);