Page 1 of 1

Box plugin - Box_getFileContent no response parameter

Posted: Wed Feb 19, 2014 1:51 pm
by Kartik A

I am using box plugin to retrieve the actual content of the file using Box_getFileContent and upload the file into the File db using files_create_service but I do not see response parameter for service Box_getFileContent. Could you please advise how could I map the response return(file content) to the create service(files_create_service) of File DB.

https://api.box.com/2.0/files/{id}/co...


Box plugin - Box_getFileContent no response parameter

Posted: Wed Feb 19, 2014 3:10 pm
by Kateryna Grynko

Hi Kartik,

Do you pass correct parameters? Please try how it works in any REST client.


Box plugin - Box_getFileContent no response parameter

Posted: Thu Feb 20, 2014 5:42 am
by Kartik A

Hi Katya,

When I executed Box_getFileContent service from the Box Plugin it return file content as stream of data in jqXHR.responseText as shown in below screen shot 1.

I added following code into the Box Plugin handle class.

1) Modified the Box_handler.js - FileInfoServiceHelper - successHandler to check if the extension is .doc or .docx then call the fileContentService.execute as shown in ScreenShot 2 to get .docx file content from Box.com using Box Plugin provided services.

2) Modified the Box_handler.js - FileInfoServiceHelper - completeHandler (ScreenShot 3) to call setFileData() to create blob and upload() to upload the blob (.docx file content) to File DB from Upload.js as shown in ScreenShot 4.

3) File uploaded successfully to the File db but .docx extension is missing(ScreenShot 5) though it show correct content type and when I try to download the file from File DB and open in MS Office it says corrupted.

I am struggling to make it work. What I am trying to achieve is Download the file from Box using Box Plugin and upload into File DB. Please advise what I am missing in below implementation.

ScreenShot 1 :-

Image

ScreenShot 2 : -

Image

ScreenShot 3 :-

Image

ScreenShot 4 :-

Image

ScreenShot 5 :-

Image


Box plugin - Box_getFileContent no response parameter

Posted: Thu Feb 20, 2014 9:14 am
by Kateryna Grynko

Hi Kartik,

Appery.io works with XML/JSON data only, all the other things you can do manually, using Generic service, for example: http://docs.appery.io/documentation/u...


Box plugin - Box_getFileContent no response parameter

Posted: Fri Feb 21, 2014 8:24 pm
by Kartik A

HI Katya,

I have been trying to download file content from the box and then send that file content to File DB to upload but no luck till now. Its uploading in File DB but in corrupted format.

I am thinking of a alternate approach. Instead of downloading the actual content of the file can I upload a file to Appery File DB from a public file URL for example a public URL like http://www.gradsch.ohio-state.edu/dep.... Please advise?


Box plugin - Box_getFileContent no response parameter

Posted: Fri Feb 21, 2014 9:59 pm
by Kartik A

Hi Katya,

I tried to load a file to appery File collection using file create DB service by providing URL of the file location as value for data field as shown in screen shot below. The service executed successfully and provided the uploaded file URL in the response but when I try to access the file using the file access URL provided in the response it couldnt open the pdf file and I get a message by pdf reader file corrupted. Please advise why the file is getting corrupted while loading.

Image


Box plugin - Box_getFileContent no response parameter

Posted: Fri Feb 21, 2014 10:24 pm
by Maryna Brodina

Hello! Working on it...


Box plugin - Box_getFileContent no response parameter

Posted: Sun Feb 23, 2014 12:04 am
by Kartik A

Hi Maryna,

Any luck with this issue?


Box plugin - Box_getFileContent no response parameter

Posted: Sun Feb 23, 2014 12:22 am
by Illya Stepanov

Hi Kartik, no news for now unfortunately.


Box plugin - Box_getFileContent no response parameter

Posted: Mon Feb 24, 2014 9:26 am
by Maryna Brodina

Hello!
1) Regarding your last question - there is no option to do that... There is no API to upload file using URL
2) Looks like the problem is in your code in uplaod.js file. Please check what is in file variable. Do console.log and check what is stored there. You'll find out what to fix in upload and/or setFileData function.