Skip to main content

Hi,

I am trying to upload an image into GCP bucket using automation anywhere package, without need of any external scripting like python or javascript. I have tried using REST package POST action and HTTP file request POST file action (Screenshot for the same is attached here). Response is showing that file is getting uploded successfully into GCP bucket, but when I am trying to open the same image file, it is getting corrupted. 

Can anyone please help me with this problem.

Thanks in advance.

Use Base64 conversion then try to upload, this should work. If it still doesn’t work let me know, i can help you.


Hi ​@madhu subbegowda 

I tried with Base64 conversion as well but still not working. Here sContent variable is Base64 converted image. Please let me know if I am missing anything.

 


It looks like the image file might not be getting uploaded correctly due to improper encoding or incorrect content type settings. Here are a few things you can check and try while using the Automation Anywhere REST package or HTTP request package:

Check Content-Type Header - for example: a. Content-Type: image/png (for PNG files). b. Content-Type: image/jpeg (for JPG files)

Check for file Handling in HTTP Request Package - When using the "HTTP file request" package, confirm that the file is being uploaded as binary data. The file might be get corrupted if it's being treated as text instead of binary.

Verify GCP Permissions and Upload Method - Check for IAM permission for GCP bucket, if it allows you to upload and access the files properly. Try to uploading same using postman to see if it problem with AA or GCP itself. Once you upload, download the uploaded file and compare its size with the original file. if it is different then it might be getting modified during upload. Also, try PUT instead of POST method, sometimes PUT works instead of POST for file uploads. For this check GCP document for correct method.

If it still doesn’t work, please share me the exact API request you are using (without sensitive data). 

 


Hi ​@madhu subbegowda,

I am using below API request for iamge upload (please replace variable from the API) : https://storage.googleapis.com/upload/storage/v1/b/$sBucketName$/o?uploadType=media&name=$sGCPFilePath$

  1. HTTP file request POST method :

 

  1. REST : POST method
  • using below method, for converting into Base64

     

  • and with these parameters (Here sContent is binary data from above action

 

I tried the same thing with postman and it is working. Even manual upload is not a problem. If you could provide me, what API end point you are using and with what parameters, that will be really helpful.

 

Thanks & Regards

Ajay Biswas


Reply