Forum Discussion
DineshRampal
8 years agoQrew Cadet
Hi Matthew
Thanks for the revert. My issue is not that ... as I have tested it by removing mandatory setting also, but it still doesn't work. The xml content is simply not send to the quickbase. I did simple tests to determinde that.
The issue as per me is that how do i post a http request (since I am running from outside quickbase) for adding a record and uploading a attachment field.
Can you help me over there ?
My code looks like this :-
var vxml = '<qdbapi><udata>mydata</udata><usertoken>token<\usertoken><field name="Upload" filename="b.pdf">'+buf1+'</field></qdbqpi>';
request({
url : "https://apollotyres.quickbase.com";,
path: "/db/bm3uve9ig",
method: "POST",
headers: {
"content-type": "text/xml" ,
"QUICKBASE-ACTION": "API_AddRecord"
},
data:vxml
}, function (err, remoteResponse, remotebody){
if (err) {console.log("error"+remoteResponse+" -- "+err); }
console.log("error "+remoteResponse +" "+remotebody);
});
Please note buf1 in first line of code where i have declared the XML variable is a base64 encoded content of a PDF file which i am trying to upload. I am aware how to add a record by passing all parameters data through URL, but unable to do so by passing the XML as data in request.
Hope you can guide me.
regards
dinesh
Thanks for the revert. My issue is not that ... as I have tested it by removing mandatory setting also, but it still doesn't work. The xml content is simply not send to the quickbase. I did simple tests to determinde that.
The issue as per me is that how do i post a http request (since I am running from outside quickbase) for adding a record and uploading a attachment field.
Can you help me over there ?
My code looks like this :-
var vxml = '<qdbapi><udata>mydata</udata><usertoken>token<\usertoken><field name="Upload" filename="b.pdf">'+buf1+'</field></qdbqpi>';
request({
url : "https://apollotyres.quickbase.com";,
path: "/db/bm3uve9ig",
method: "POST",
headers: {
"content-type": "text/xml" ,
"QUICKBASE-ACTION": "API_AddRecord"
},
data:vxml
}, function (err, remoteResponse, remotebody){
if (err) {console.log("error"+remoteResponse+" -- "+err); }
console.log("error "+remoteResponse +" "+remotebody);
});
Please note buf1 in first line of code where i have declared the XML variable is a base64 encoded content of a PDF file which i am trying to upload. I am aware how to add a record by passing all parameters data through URL, but unable to do so by passing the XML as data in request.
Hope you can guide me.
regards
dinesh