Skip to content
Downloading a file ...
 
Notifications
Clear all

Downloading a file with authentication requirements

5 Posts
3 Users
0 Reactions
4 Views
RobertAndrews
(@robertandrews)
Posts: 2
New Member
Topic starter
 

I'm utilizing the transcription service Rev through its API.

Rev’s API requires authentication via a plain header, not Basic Authentication - API Documentation - Authentication - Rev
I'm already using the “HTTP” module with the header “Authorization” set to "Rev [ClientAPIKey]:[UserAPIKey]".

My next step is to download a transcript file.

According to API Documentation - Get order information - Rev, the URL for the downloadable transcript is structured like this: https://www.rev.com/api/v1/attachments/stRinG-OF-teXT-liKE-thIs/content

However, this file isn't publicly accessible and also requires authentication. This seems to render the “Get File” module unusable.

I've tried using the “HTTP” module again, which does grant access to the file. However, the results pane only displays binary data (e.g., “Buffer, codepage: binary … End of data sample, buffer was originally 157524 bytes long. SHA1: xxxxxxxxxxx”).

Therefore, my question is: how can I download this binary data as an actual file?

For example, I need to add this file to an Airtable attachment field. On the callin.io side, this field accepts only “File URL” and “File Name”.

Please advise on how to proceed.

 
Posted : 15/01/2023 10:22 pm
Callinetic
(@callinetic)
Posts: 13
Active Member
 

Hi ,

There you have the content of your file.

:slight_smile:

However, I checked the airtable API and it seems like it’s not possible to upload files. Instead, you should pass-through an URL that will be used by airtable to download the document and store a copy at their end.
You can consider creating a second scenario that uses parameters to request the right file from Rev and then pass the URL of the webhook with the correct parameters to Airtable to download the correct document. Another option would be to use a cloud storage service like Google Drive. You can upload the file to Google Drive and then pass the sharable link to Airtable’s attachment field.

I hope this helps you find the right solution.

Glenn - Callinetic

 
Posted : 16/01/2023 10:05 am
RobertAndrews
(@robertandrews)
Posts: 2
New Member
Topic starter
 

I appreciate the suggestions, but my main challenge is figuring out how to extract the binary data from the response and save it to a file initially.

 
Posted : 16/01/2023 6:43 pm
Callinetic
(@callinetic)
Posts: 13
Active Member
 

To extract binary data from a response and save it as a file, you can utilize the toString function, which is available as a text function. For instance, if you're attempting to download a text file from Google Drive, you can employ this function to convert the binary data into text and then save it as a file.

image

image

image

Glenn - Callinetic

 
Posted : 16/01/2023 8:40 pm
Benny
(@benny)
Posts: 1
New Member
 

Not sure if this is relevant, but I came across this page while looking for methods to convert the response body of a custom webhook that was consistently returning data in binary format.

If you have control over the endpoint you're querying and can customize the Return Headers, you have the ability to set the Content-type as you prefer.

In my specific case, I wanted to utilize the built-in “Parse Response” feature available in the “HTTP callin.io a Request” Module.

However, my custom webhook was returning the data in binary, preventing it from being parsed.

I discovered that if I wanted the data to be returned in JSON format for parsing, I just needed to add the Content-type header to the Webhook response module and set it to application/json;charset=utf-8 in my scenario.

 
Posted : 14/03/2023 2:22 am
Share: