cancel
Showing results for 
Search instead for 
Did you mean: 

Upload file to Google Drive via API

PABLOPEREZ-ENCI
Level 2
We are using BP version 6.3

I want to know how is the best way to upload file to Google Drive without using browser or other app to syncrohnize the folders.


Thanks
1 BEST ANSWER

Helpful Answers

Hi Pablo,

There is a community supported Skill available on the Digital Exchange which is available to manage Google Drive (including uploading files), although unfortunately this is only supported from version 6.5 onwards:

https://digitalexchange.blueprism.com/dx/entry/9648/solution/drive-api-v3-2

On version 6.3 there are a number of VBOs which may help you develop similar functionality, although they are not as fully featured as the Web API Services feature (introduced in 6.4) which the above skill is based on:

Where can I find the Utility - HTTP Communication VBO?
Where can I find the Webservices - REST VBO?
Where can I find the Webservices - OAuth 2.0 VBO?

The documentation for the Google Drive API is available here:

https://developers.google.com/drive/

Kind Regards,

------------------------------
James Roberts
------------------------------

View answer in original post

11 REPLIES 11

Hi Pablo,

There is a community supported Skill available on the Digital Exchange which is available to manage Google Drive (including uploading files), although unfortunately this is only supported from version 6.5 onwards:

https://digitalexchange.blueprism.com/dx/entry/9648/solution/drive-api-v3-2

On version 6.3 there are a number of VBOs which may help you develop similar functionality, although they are not as fully featured as the Web API Services feature (introduced in 6.4) which the above skill is based on:

Where can I find the Utility - HTTP Communication VBO?
Where can I find the Webservices - REST VBO?
Where can I find the Webservices - OAuth 2.0 VBO?

The documentation for the Google Drive API is available here:

https://developers.google.com/drive/

Kind Regards,

------------------------------
James Roberts
------------------------------

HI James, 

i have question on similar lines, we are using Veeva APIs to upload a file to veeva, we are able to do that using Postman application, since we have an option there to change the parameter type to 'File' and enter the file path to achieve this =, do you have any info how we can upload a file using Blueprism HTTP utility ? i am looking into this but want to share this on portal to resolve it quickly.

------------------------------
Ishan Mahajan
India
------------------------------

In Body content you can select Single File and then send the file as Binary.

------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------

Can you please elaborate ? as per the parameters available, Body needs to go as 'Text' and content type needs to go in header, i need to send some more parameter along with the file in order to complete the reqiurement.

------------------------------
Ishan Mahajan
India
------------------------------

Can you try this in Body


12022.png
and then specify content-type in header of that action.12023.png

If you have more parameters then you can define body template in Image 1.


------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------

Hi Ishan,

There are a couple of different ways to achieve this that I'm aware of, although it depends on the version of Blue Prism you are using and the type of request that your Web Service is expecting to receive:

1 - Using the 'Web API Services' feature introduced in version 6.4.

- This feature provides two built-in ways to send files via the 'Body Content' option which is detailed on page 27 of the following guide:

v6.4 User Guide - Web API Services

It's worth noting that if you use one of these options then the Content-Type header is automatically set and doesn't need to be set anywhere else:

"Single File" - in this case, the Content-Type will be set to application/octet-stream, and you can send no more than one file.

"Multiple Files" - for this option, the Content-Type will be set to multipart/form-data, and you can send either one or multiple files.

- The option you will want to choose will depend on what Content-Type will be accepted by the web service, so you may want to consult the documentation for the API you are using - although if you're using the 'form-data' option in POSTMAN I think that maps to the 'Multiple Files' option.

2 - Using the Utility - HTTP VBO

- You may be able to send files within the Body of your request via this VBO, there is an example of how to do this for a multipart/form-data request in the following knowledgebase article:

How can I use the 'HTTP Communication VBO' to send a file using a "multipart/form-data" type request?

- This is one example of many different potential configurations, so may require quite a bit of extra configuration.

Overall I'd recommend using the 'Web API Feature' if you can as the configuration is generally much simpler.

------------------------------
James Roberts
------------------------------

@james.roberts.bp ​James, for the 'Multiple Files' can you elaborate on setting up the collection?

I am trying to upload a file and have it working through Postman, when looking at the log I see this and I'm using the file option for the form-data in the body.

Content-Type: multipart/form-data; boundary=--------------------------574639511453299179934016
Content-Length: 1179190
----------------------------574639511453299179934016
Content-Disposition: form-data; name="file"; filename="1718367-2019-1231-MID; 1040.pdf"
Content-Type: application/pdf

<1718367-2019-1231-MID; 1040.pdf>
----------------------------574639511453299179934016--

I have tried setting up the following fields in a collection I am piping into the multiple files API request action.
Boundary with a value of ------------------------
name with a value of file
and filename with a value of the file path to the file I want to upload. When I try to run this I get the following output (I'm currently not sending the data so I can validate what is being sent).

POST api end point url
Content-Type: multipart/form-data; boundary=



------------------------------
Tracy Schultz
------------------------------

Hi Tracy,

The required fields for a collection can often be populated using the 'Import' option available here:

12026.png
For your example you will likely need to set the fields up in your collection as follows:

File (Binary) - The binary of the file you are uploading.
File Name (Text) - "1718367-2019-1231-MID; 1040.pdf"
Field Name (Text) - "file"
Content-Type (Text) - "application/pdf"

I hope this helps!

------------------------------
James Roberts
------------------------------

Hi James Robert,

I have followed the steps that you have mentioned in How can I use the 'HTTP Communication VBO' to send a file using a "multipart/form-data" type request?.  I am able to upload only text files,other file types like like pdf are getting corrupted after uploading. Could you please let me know how to upload other files as well, including images.(I need to upload files to sharepoint via web api built by mulesoft using multipart/form-data) I tried inbuilt web api from blueprism as well, it didnt worked as I have to send meta data like filename and content type along with File value.

------------------------------
Sireesha
------------------------------