Uploading a PDF file directly into Sharefile via their API
I need to upload multiple large PDF files directly into a ShareFile Folder (https://api.sharefile.com/samples/ruby). Right now I am reading and saving the file data as binary data in a model and then calling it in a background job to be uploaded into ShareFile. I find that I am running out of memory in Heroku. I am sure there is a better way to do this. Any pointers/tips would be greatly appreciated.
The files have to go into ShareFile.
Thank you very much.
To upload a PDF file directly into ShareFile via their API, you would typically follow these general steps:
Authentication: You need to authenticate with ShareFile's API using your account credentials or an API key.
Prepare the File: You should prepare the PDF file you want to upload. Ensure that you have its binary data ready to be sent over the API.
Upload the File: Use the ShareFile API's endpoint for file upload to send the PDF file data.
Remember to replace placeholders like YOUR_SUBDOMAIN, YourFolderID, your_client_id, your_client_secret, your_username, your_password, and path_to_your_pdf_file.pdf with your actual ShareFile subdomain, folder ID, client ID, client secret, username, password, and the path to your PDF file.
Ensure you handle errors and exceptions properly, and consider security practices such as storing credentials securely and handling access tokens securely. Additionally, you may need to adjust the code according to ShareFile API documentation and any specific requirements or limitations of your use case.