02-02-23 02:44 PM
Hi
Please can I have some assistance with regards to uploading a document to Box via an API.
Currently our API's go through Mulesoft, I have managed to create API's in Blue Prism to Search, Delete Folder, Delete File, Get folders etc... However I can get the Document Upload request to work.
This is working in Postman, but I am unsure how to move this into Blue Prism. We are using Basic Access which works fine.
I have done all of it so far via Web API Services and would like to keep the upload in that part also
I have attached a file with what postman looks like and from BOX what they require.
Thank you
21-02-23 02:03 PM
In the HTTP VBO, try adding System.Web. in front of MimeMapping. The end result would look like this: System.Web.MimeMapping.GetMimeMapping.
I'll spend some time today looking at the template body for your Web API implementation.
Cheers,
21-02-23 02:22 PM
Thank you for the help, I have amended the code and I still see the same error message
24-02-23 09:54 AM
Thank you very much for your help
09-03-23 08:32 AM
Good morning @ewilson
Do you have any update on the above please?
Thank you
Matt
14-03-23 05:09 PM
Apologies for being out of touch on this. In your tests, do you know the size of the files you've been working with? The reason I ask is that the Box API has two different upload actions depending on the size of the file. If it's less than 50MB, it's a straight upload. If it's bigger than it needs to be a chunked upload.
Cheers,
14-03-23 11:03 PM
FYI - I got a simple Web API example working with a Template body. The issue with using a template though is that it won't allow you to properly handle situations where you need to upload a file larger than 50MB and have to chunk it. For that reason, it's probably best to implement at least that part in a VBO. Let me know your thoughts and we can whip something up.
NOTE: The key here is getting the boundary definition correct. Whatever boundary you define in the Content-Type header (ex. ---ABC), you have to make sure you add 2 additional dashes at the front of the boundary when you actually use it in the body. This is from the specification. So in the example about I would create a Content-Type header that include multipart/form-data; boundary=---ABC ( notice there are 3 dashes). When I actually use this boundary in the body, I would define it as -----ABC (5 total dashes). End the end boundary would be -----ABC--.
Here's some screenshots from the template example:
Cheers,
20-03-23 03:42 PM
Hi @ewilson
Thank you very much for the above, sorry for the delay, i was off last week.
I have replicated on what you have mentioned above, however i am still receiving a 400 Bad Request error.
Please can you have a look to see if there is anything I am doing incorrectly.
Thank you
21-03-23 06:16 PM
I'm traveling for meetings this week, so not as active on the Community. I've attached a .bprelease that contains the test Web API Service that I put together. You might try importing and testing it in your environment. The only thing I can think of is that maybe Box is not happy with the Folder ID you're providing. In my tests I've used 0 as the Folder ID which basically says to upload the file to the root of the account tied to the authentication credential.
Cheers,
22-03-23 01:07 PM
Hi @ewilson
Thank you very much for the support, this has worked. :)
From what I can see the only difference between our two was the Boundary.
I have also had to upload via Binary and use the Encode 64 but this works fine.
Thank you for all your help.
Matt
22-03-23 02:03 PM
Glad to hear it worked for you. Keep in mind that if you need to upload files larger than 50MB there's a completely different endpoint for that. Larger files require the use of an upload session and chunking with the Box API. You won't be able to do that with a Web API though. It will have to be a in a VBO.
Cheers,