About EasyMorph Tutorials & Examples Web-help

Files in web requests

Hi all

Just wondering whether anyone has managed to send files in web request? If so how did you do it?

Thanks

Shaheed

Hi @Shaheed_Fazal,

For now it is possible to send an entire file content as request body. You should set Content-Type header to appropriate content type and Body.File to the file that you want to send.
However, such kind of transfering as multipart/form-data is not supported yet.

Could you also provide some details about what kind of files you want to send and what protocol/ transfer mode you’re going to use? Thanks.

Apologies for the delay in replying. I’m just getting round to trying this. I am trying to upload a CSV file to Zoho Analytics via their API.

I am trying to use the Import Data method using the documentation here.

According to their API:

Parameters to be passed via the body of POST Request

Apart from the parameters passed in the Query string, additional information needed for specific actions (such as values of row in a Add Row operation etc.,) needs to be passed as POST parameters

<param>1=<value>1&<param2>=<value2>....

The parameters should be encoded in application/x-www-form-urlencoded format (This is the default format used by any simple html form).

**Note: In the case of importing csv files multipart/form-data format should be used. (This is the default format used by html forms that contain file type fields used for uploading files)**

Does this mean I can specify the file as a parameter in the below section?

Uploading files is not possible with Web Request yet.

You probably need to use the Add Row API as described here: https://www.zoho.com/analytics/api/?shell#data-api

In this case, your EasyMorph project would be:

  1. Read the CSV file in EasyMorph
  2. Use the “Iterate Web Request” action to send the contents of the file line by line to Zoho Analytics’ Add Row API

However, if your CSV files have a lot of data uploading would be slow.

Alternatively, as a suggestion (that I didn’t try or explore), use a 3rd party workflow tool (such as Zoho Flow, IFTTT or Zapier) to create a process that imports a CSV file from Google Drive into Zoho analytics. Then trigger this workflow through API from EasyMorph using Web Request.

Thanks for the response. It seems the third party services do not support the import data method. Using the Add Row method would be too time consuming as my dataset is large.

When do you expect to be able to add the feature for uploading files?

I might use CURL in the interim since it is now part of Windows Powershell…

We’ve seen a few requests for uploading files, so apparently it’s a frequently requested feature. We’ve planned it for one of the soonest releases.

To learn more about EasyMorph visit easymorph.com.