Sigma and OneDrive

Sigma and OneDrive

Hey everyone,

I'm currently looking into creating a custom extension that integrates Zoho Projects and OneDrive. Currently, I have it as far as reading items from OneDrive, which is dandy and all, but am looking to expand into file uploading.

I would like to be able to drag-and-drop files onto the extension, then upload those files to OneDrive. I'm currently attempting to upload a simple sample text file via the extension, but to no success.

Here's some example code, lifted mainly from the documentation found here:
  1. var url = "/me/drive/root:/FileB.txt:/content"

    var file_details = {
        type: "PUT",
        headers: {
            "Content-Type": "application/binary"
        },
        files: [{
            "Value": "01010100 01100101 01110011 01110100 00100000 01000010 01101001 01101110 01100001 01110010 01111001"
        }]
    }

    zohoprojects.request(url, file_details, "onedrive").then(function(response) {
        console.log(response);
    });

I'm assuming that I want to run things through zohoprojects.request() since the connector is handling the auth tokens in the background, but all it ever spits out is "Oops! Something has gone wrong., status: failure" with no additional information.

Zoho's JS SDK documentation here states that the request object can have a "files" key, where the value is a JSONArray, and has some mentions about the body being ignored if the actual file is uploaded, and mentioning a binary type, but I don't quite understand the actual meaning. Is there an example I can check out that handles file uploading?

Can someone point me in the right direction here? Am I building the request incorrectly? Is there a way to get more meaningful information from the zohoprojects.request() response?

Thanks again,

Lee