function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nagaraj SVNagaraj SV 

Salesforce to Onehub Image uploading ?


I have to send image from Salesforce to ONEHUB.

for this i have code snippet in RUBY.Could you please help me to write In Apex.

Code sinnpet from ONEHUB 

Set up your instance of the Oauth2 client for multipart posts. 

In ruby, using the Oauth2 library, it’s something like this:
client =, client_app_secret, :site => ‘’, :ssl => {:verify => true}) do |b|
b.request :multipart
b.request :url_encoded
b.adapter Faraday.default_adapter

< handle all of the authentication here, e.g. token =… >

Then, make the body from a local file in your directory:
pathname = ‘./logo_onehub_ws.png’

1.local file name ./logo_onehub_ws.png will be stored in folder FOLDER_ID as ‘foo1.png’
upload =,‘rb’), 
‘application/octet-stream’, ‘foo1.png’)

payload = { :file => { :name => File.basename(pathname), :‘form-data’ => upload } }

Post to the folder specified by its numeric ID
resp =“/folders/#{FOLDER_ID}/files.json”, body: payload)
you will get back a json payload with the file information in it.

Andy BoettcherAndy Boettcher
It sounds like you're looking for someone to write the code for this project. These forums are not meant for that; you'll want to post over on the AppExchange site where you can match up with a developer looking to work on your project. You can also check out Trailhead to start your own learning process of how to start writing Apex.
Nagaraj SVNagaraj SV

Thank you ..

I have developed code no need of trail heads ...

And i am not asking any one to do this project ..

I am looking for a person and he know both RUBY and APEX that's it.

If you know BOTH let me know .


Andy BoettcherAndy Boettcher

We are more than happy to help you through problems and assist with compilation errors, debug problems, etc - but we will not write your code for you.  You need to try it on your own first.
Nagaraj SVNagaraj SV

Andy Boettcher

Oh thats nice .

I am doing in my own.

Thank you