Skip to main content

Hi! 

I have been using the HTTPCaller Specify Upload Body to upload files to Saleforce. It has been working smoothly with only one problem, which is the size limit that can be uploaded via this method. Saleforce advises that I need to use Mutipart method instead.

 

If I’m using Python, below is the data that I will be sending with Multipart method (basically I just wanted to upload this file called test.PNG):

>('entity_content', b'\n------boundaryString\nContent-Disposition: form-data; name="entity_content";\nContent-Type: application/json\n\n{\n    "ContentDocumentId" : "",\n    "ReasonForChange" : "test upload",\n    "PathOnClient" : "test.PNG"\n}\n\n------boundaryString\nContent-Type: application/octet-stream\nContent-Disposition: form-data; name="VersionData"; filename="test.PNG"\n\n'), ('VersionData', ('test.PNG', <_io.BufferedReader name='<file_path>test.PNG'>, 'application/octet-stream')), ('', b'\n------boundaryString--\n')]

 

However I’m not sure how to populate those data into the FME HTTP Caller:

 

Hey I have no experience with Salesforce and my experience with multipart uploads is limited but I can give you an example for a completely different API. I know this is not a direct answer but maybe it can give you some ideas on where to look. This is a multipart upload to a ArcGIS portal for a shapefile (zipped). I added two pictures to give you a view of all the attributes in the multipart I am sending with the call. You can check the official documentation for this call here:  https://developers.arcgis.com/rest/users-groups-and-items/add-item/

I hope this helps you out a little bit

p.s. maybe the problem is that you first need to write your .png file and then direct the httpcaller the the file location instead of trying to upload the file by reading the data into FME.


Hey I have no experience with Salesforce and my experience with multipart uploads is limited but I can give you an example for a completely different API. I know this is not a direct answer but maybe it can give you some ideas on where to look. This is a multipart upload to a ArcGIS portal for a shapefile (zipped). I added two pictures to give you a view of all the attributes in the multipart I am sending with the call. You can check the official documentation for this call here:  https://developers.arcgis.com/rest/users-groups-and-items/add-item/

I hope this helps you out a little bit

p.s. maybe the problem is that you first need to write your .png file and then direct the httpcaller the the file location instead of trying to upload the file by reading the data into FME.

Thank you very much for your response!

I wonder:

  • What’s your header section looks like?
  • When you said I need to write the PNG first, does it mean that I need to create the file within FME (by using a feature writer)? What if the file is just sitting in my local drive, would that work?
  • When I was using Specify Upload Body upload, I need to firstly convert the file to base64, is this a step required for Multipart? - from the screenshot, looks like you don’t need any conversion, but just uploading the file in the ZIP format?

Thanks again!


stuff

Thank you very much for your response!

I wonder:

  • What’s your header section looks like?
  • When you said I need to write the PNG first, does it mean that I need to create the file within FME (by using a feature writer)? What if the file is just sitting in my local drive, would that work?
  • When I was using Specify Upload Body upload, I need to firstly convert the file to base64, is this a step required for Multipart? - from the screenshot, looks like you don’t need any conversion, but just uploading the file in the ZIP format?

Thanks again!

I checked my HttpCaller and I don't use any headers at all for this call but it might be different for your use case, it's really dependent on the Salesforce API. If your .png file is just somewhere in your files then that is good enough I think, you just need to supply the path to the file in the HttpCaller in the file attribute for the Multipart upload. I don't think you need to convert to Base64, I can vaguely remember struggling with this as well when I was working on my use case. Apparently FME just converts stuff?? 


Reply