I need to import file attachments into Quickbase from a file server on LAN by using a scripting technology

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Doesn't Need an Answer
Hi ,
I have a requirement of uploading multiple attachments file on a daily basis into Quickbase.  I am adept at Node.JS and have used it extensively to build interfaces to other platform but I am struggling to do the same this time around.

can i have a suggestion on how to go about this ? Can i use NODE JS ? if not, what is the best way to achieve this 

would appreciate a response.

thanks
dinesh
Photo of Dinesh

Dinesh

  • 202 Points 100 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Rohit Agarwal

Rohit Agarwal

  • 552 Points 500 badge 2x thumb
Use DELL BOOMI ETL tool. It's simple and easy.
or any other ETL tool you like.
Photo of Dinesh

Dinesh

  • 202 Points 100 badge 2x thumb
HI Rohit

Never heard of it. I presume you are a pro in it.
Can you help me answer few Questions -
Is it Free open source or has a license?
Does it interface well with Quickbase ?
Does it have a huge learning curve ?
What is the best way to learn this ?

Thanks for help
regards
dinesh
Photo of Rohit Agarwal

Rohit Agarwal

  • 552 Points 500 badge 2x thumb
This is a licensed tool.
yes, it mingles well with QuickBase as well as many other tools like Salesforce etc.
yes, this is a cloud based integration tool have the huge learning curve.
https://dellboomi.myabsorb.com/#/login
use this link for learning.
Photo of Dinesh

Dinesh

  • 202 Points 100 badge 2x thumb
Dear all, I could achieve what i wanted .. i.e. importing any kind of file from my system to an Quickbase attachment filed. I used node.js (which i love in addition to my love of quickbase) to write a script and do the needful.

I am attaching a script, if it can be of any help to other fellow community folks. it is yet to be modified for reading all files in a directory which has new / modiiied since last scheduled read of file list in a directory, but that is easy and can be done.

Hope somebody finds it useful and leaves a note.

-- complete Code.---

// test programe to read files for integration with Ispec
.
var http = require('https'); // http request module to push request to quickbase.
var request = require('request'); // npm install request
var fs = require("fs"); // since we want to read files from server

cheerio = require ('cheerio'); // parse XML

console.log("Going to open an existing file");

var bitmap = fs.readFileSync('d:\\MyData\\MyNode.js\\Certificates\\demo.pptx');
    // convert binary data to base64 encoded string as quickbase uploads file in base64 only.
uploadfiletoqb(new Buffer(bitmap).toString('base64')); 

function uploadfiletoqb(buf1)
{

//*** create authentication ticket.. enable application tokens in your project in qb
var resauth = "";
request({
        url : "https://xxxxx.quickbase.com/db/main?a=API_Authenticate&username=youremailaddress&password=yo... password",
method: "POST", 
headers: {
"content-type": "application/xml" ,


}, function (err, remoteResponse, remotebody){

//console.log("ok "+remoteResponse +" remote body "+remotebody);

auth(remotebody,buf1); // call method to authenticate and create ticket.

if (err) {console.log("error"+remoteResponse+" -- "+err); }
    //console.log("error "+remoteResponse +" "+remotebody);
});




}


function auth(auttkt,buf1)
{

 var tkt = "";

var $ = cheerio.load(auttkt);
var errordescr = "";

$('qdbapi').each(function(i, element){
          var id = $(this);
    
 var childobj = $(this).children().first(); // get the first child 
 var child = $(this).children().length; // count total no. of childs.
 for (i=0;i<child-1;i++)
 {
  childobj = childobj.next();



var val = childobj.text();


if (childobj[0].name =="ticket")
{
tkt = childobj.text();
//console.log("ticket"+tkt);
}



 }
 
 
        }); 

// call upload file method to process in quickbase and pass authentication tkt.
upfile(tkt,buf1);

}


function upfile(tkt,buf1)
{

// create xml upload ...see use of apptoken and file is concatenated as a string. var buf1 which is passed from above.
var vxml ='<qdbapi>'+
'<udata>mydata</udata>'+
'<ticket>'+tkt+'</ticket>'+
'<apptoken>enter your app token</apptoken>'+
'<field name="otherfield">Dinesh Rampal</field>'+
'<field name="MyFile" filename="demo.pptx">'+buf1+'</field>'+
'</qdbapi>';


console.log("-----");
console.log(vxml);
console.log("-----");

// create a reqeust to post to quickbase.
request({
   url : "https://xxxxx.quickbase.com/db/dbid";,
method: "POST", 
headers: {
"content-type": "application/xml" ,
"QUICKBASE-ACTION": "API_AddRecord"
}, 
body:vxml
}, function (err, remoteResponse, remotebody){
console.log("ok "+remoteResponse +" "+remotebody);
if (err) {console.log("error"+remoteResponse+" -- "+err); }
    console.log("error "+remoteResponse +" "+remotebody);
});
      

}

// create node server.
http.createServer(function (request, response) {

   // Send the HTTP header 
   // HTTP Status: 200 : OK
   // Content Type: text/plain
   response.writeHead(200, {'Content-Type': 'text/plain'});
   
   // Send the response body as "Hello World"
   response.end('Hello World\n');
}).listen(8081);

// Console will print the message
console.log('Server running at http://127.0.0.1:8081/');