Connecting to SAP Business One with Nodejs

PHOTO EMBED

Fri Apr 22 2022 20:14:01 GMT+0000 (Coordinated Universal Time)

Saved by @soyreynald ##nodejs ##sap ##request ##legacy

const request = require("request");
var url = "https://localhost:50000/b1s/v2/Login";
var body = {
  CompanyDB: "",
  Password: "",
  UserName: "",
};
var postheaders = {
  "Content-Type": "application/json",
};
var options = {
  url: url,
  method: "POST",
  json: body,
  postheaders: postheaders,
  strictSSL: false,
};
request.post(options, (error, response, body) => {
    if(error){ 
        console.log(error);
    
    } else {
        console.log(body);
    }
});
content_copyCOPY

This code is legacy, it works though.