Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Box plugin - Box_getFileContent no response parameter

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...

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Box plugin - Box_getFileContent no response parameter

Hi Kartik,

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

Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Box plugin - Box_getFileContent no response parameter

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Box plugin - Box_getFileContent no response parameter

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...

Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Box plugin - Box_getFileContent no response parameter

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?

Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Box plugin - Box_getFileContent no response parameter

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Box plugin - Box_getFileContent no response parameter

Hello! Working on it...

Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Box plugin - Box_getFileContent no response parameter

Hi Maryna,

Any luck with this issue?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Box plugin - Box_getFileContent no response parameter

Hi Kartik, no news for now unfortunately.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Box plugin - Box_getFileContent no response parameter

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.

Return to “Issues”