Creating a file in an active WF attachment folder using REST

I'm trying to use my file upload function to upload (post) a file to an active workflows attachment folder but it does not seem to work, here is my code (basically I pass the WF attachments folder's ID and the file I want to upload):

    function uploadFile(folderID, blob) {
             var fd = new FormData();
            fd.append( "type", "144" );
            fd.append( "parent_id", folderID);
            fd.append( "name", "test_file" );
            fd.append( "file", blob );
            console.log( "otcsticket for file upload is: " + otcsticket );
            $.ajax({
                type: "POST",
                url: eimpath + "/nodes",
                data: fd,
                contentType: false,
                processData: false,
                beforeSend: function( xhr ) {
                    xhr.setRequestHeader( "otcsticket", otcsticket ),
                    xhr.overrideMimeType( "multipart/form-data" )
                }
                }).done(function( data ) {
                    console.log( data );
                }).fail(function( request, statusText ) {
                    console.log( statusText );
                });     
    }

this produces a 400 error. If a sub-folder is in the WF attachments folder and I pass the sub-folders ID instead the upload works, so I'm wondering if there is any other method to posting a document to the root of the WF attachment folder (I can use "get" to get back information on this node and its children).

Tagged:

Comments