I'm working on a google app script to move a pdf file from one folder in Dropbox to another. I have it working in Postman but am having trouble getting it to work in my google app script. I am getting the following error: 'responseError in call to API function "files/move:2": request body: could not decode input as JSON'
I don't know if it has anything to do with the fact that the API body is supposed to be 'raw' format. I am not familiar with this format.
function moveDocWithinDB(dropboxAccessToken,ctrData){
Logger.log("Function moveDriverDoc ");
var raw = {
"from_path":"/Driver Shared Files/Anna/Andrew Walter- RMR Shared/(Paperwork)/TEST1234568_POD.pdf",
"to_path":"/Customer Delivery Orders/Active DO's/ABC Corp/TEST1234568_POD.pdf",
"allow_shared_folder": false,
"autorename": false,
"allow_ownership_transfer": false
}
var headers= {
"Content-Type": "application/json",
"Authorization": "Bearer "+ dropboxAccessToken,
}
var options = {
method: 'POST',
headers: headers,
data: raw,
muteHttpExceptions: true,
};
var response = UrlFetchApp.fetch(apiUrl, options);
Logger.log("response" + response)
}