AdrienGregorj
8 years agoQrew Trainee
API_UploadFile with JSON data
Hey!
Probably a stupid question but I can figure out is there is a way to provide JSON data to an API_UploadFile call. At the moment I use xml data like this:
Thank you!
Adrien
Probably a stupid question but I can figure out is there is a way to provide JSON data to an API_UploadFile call. At the moment I use xml data like this:
var req = "";But I would prefer something like
req += "<qdbapi>";
req += "<apptoken>" + QBU_apptoken + "</apptoken>";
req += "<rid>1</rid>";
req += "<field fid='6' filename='" + fineName" + "'>";
req += fileContent;
req += "</field>";
req += "</qdbapi>";
$.ajax({
url: QBU_tabledbid + "app?act=API_UploadFile",
type: 'POST',
data: req,
contentType: "text/xml",
dataType: "xml",
processData: false
});
$.post(QBU_tabledbid, {but I am struggling to find the correct syntax...
act: "API_UploadFile",
rid: 1,
field: {
fid: 6,
filename: fileName,
value: fileContent
}
})
Thank you!
Adrien