Uploading a file to Box

Hi

I am struggling with this a little.

All I want to do is upload a file to Box. I have it working - but if the file exists, I get an error. I need to replace the file - but there is no setting to do that. If I ignore the error, the new file doesn’t get uploaded.

I’ve tried deleting the file first, but don’t seem to be able to do it (despite many attempts)

Any suggestions?

Andrew

Hey @Andrew_Davies,

Great to see your question here in the community! :slight_smile:

I just wanted to clarify that this is a community of Make users helping out and sharing knowledge. This means we don’t have access to any of your scenarios, organizations etc.
It’s therefore always best to share some screenshots so that the community can see what’s going on in your scenarios visually.

Detailed information could be provided for example by an:

  1. overview of your scenario setup (functions, mappings, variables etc.)
  2. the input area of the module you are having trouble with
  3. the output area of the module you are getting data from

Thank you!

In case you think this is not needed, please disregard this message. I have send this message by automation since you don’t have any attachments.

1 Like

Can any one help at all? Really struggling.

Hey @Andrew_Davies ,

I haven’t used Box before but looking at their reference (https://developer.box.com/reference/) it seems like there is not really an API call to update a files content. Most likely you have to do the following in your flow:

  • Search for the file
  • If the file exists, delete it
  • Upload the file again (new content)
  • If the file does not exist, upload it without deleting it

You can do this with a Router to filter based on if it exists or not. Let me know if this helps you.

Thanks Drivn - will give it a go!

Hi

Thanks again Drivn.

Do you know where I can get techicnal support for the Box integration?

It seems, to me, to be extremely flaky and the help pages don’t have much info.

For example - to search for a file, it says to wrap the query in double quotes to get an exact match, but that gives me a long list of close matches.

It seems to do other odd things too. Despite entering a folder ID to restrict the search - it searches everywhere.

See screenshot

Andrew

Hey @Andrew_Davies ,

I would have no clue, since I can not see what kind of request its sending in the API and I’ve never used it. What I can give as advice is to look at these 2 links. It looks like these explain how to use this Module:
Search content: https://developer.box.com/reference/get-search/
Query: https://developer.box.com/guides/search/query-operators/

Hope this helps you!
~Bjorn

1 Like

Thanks for this Bjorn - much appreciated.

Just came back to this as my scenario had failed. Still can’t get the Box modules to work. They are a nightmare.

All I want to do is

  • Create a folder (if it doesn’t exist) in a specific location
  • If the file I am uploading exists, delete it (as it must be an old version)
  • upload the file.

I’ve tried error handling , searching for files and folders, getting the entire contents of a folder - but none seems to work. Box needs to know the ID of any file or folder (not the name, the ID) - so just to see if a file already exists, I have to get the folder contents and filter it by file / name - just in case it exists! (9 times out of 10 it doesn’t) Seems bery long winded!

Andrew


I got there in the end (I think!). Took hours and uses a lot of operations.

This Scenario -

  • Sets some variables (filename, root folder ID etc) - Am just using this for testing for now. Will eventually be triggered by a Webhook

  • Creates a folder at the root. Error handing resumes so if it exists, it continues

  • (61) - Gets the contents of the root folder

  • (40) - Iterates through the contents of the root folder - then filters out files, and folders that don’t match the new file name ( so I can get the folder ID)

  • (55) Sets a variable with the folder ID

  • (39) Gets the contents of the final folder

  • (42) Iterates through the folder looking to see if the file I am about to upload exists.

  • (59) If it exists - delete it

  • (58) - finally upload the file.

Surely there is a better way??!!! Any help much appreciated, this uses a crazy amount of operations - it is far from efficient!

Thanks
Andrew

1 Like

I’ve given up with this.

I’ve decided to pre make all the folders so that the scenario doesn’t need to make them each time. Also making sure that there are no files with duplicate file names.

Much easier - but not ideal!

Hopefully the Box modules will get improved soon. The Dropbox module is so much easier to work with.

Have good weekends all

1 Like

I think this is a pretty solud solution @Andrew_Davies . Well done!
Right now it looks like this is the best solution and the API doesn’t provide something more efficient. It would take these amount of operations then yes.

1 Like