Help With Uploading File in HTTP Module

I could use some help with downloading an attachment from a URL and then uploading it using the http module.

I can successful get the attachment data from a URL using the ‘Download Attachment’ http module, see below.

However, when I try to then using the data in a ‘Make a request’ http module to make a PUT call to an API to upload the file I cannot get the file to successful upload.

I think there is an format/encode issue. The API documentation for the PUT call I am making says the file being uploaded must be byte. Below is an example of the file upload from their API.

Any help would be much appreciated.


421508180_10161200042788491_6281196459061896547_n

Hi @gregg_a and welcome to the Make community!
Could you share the error message you’re getting and your module settings?
I see your file name includes a special character(double quote). Have you tried a different file name (without quotes)?

2 Likes

I’m actually not getting an error message from the http module. The API that I’m sending the PUT request to is very bad at returning errors.

I’m not passing the file returned by the Download Attachment http module. See below with the attachment info I’m using in the input for the http module PUT call to upload the file.

Monosna

@gregg_a Please share either a blueprint of your scenario or at least a screenshot of it and of the settings of your modules, along with their output. Without this information, it is very difficult to help you. Thank you.

A little shot in the dark in the meantime, but is your Body Type in your HTTP POST module set to multipart/form-data?

2 Likes

Here is the blueprint

Thanks @gregg_a I’m sorry I don’t really have much time to help now. Just putting your json string through a validator shows 2 extra spaces there (in yellow):


They can sometimes be the culprit.
If it’s not the case, then hopefully someone else can take over and help. Sorry.

2 Likes

Welcome to the Make community!

Can you provide a link to your external service’s developer API documentation on uploading files? Otherwise we are all “flying blind” here.

Your screenshot didn’t show a PUT call though. Did the developer documentation also specifically ask for PUT?

2 Likes

just doubled checked, that’s not the issue.

2 Likes

@samliew the screen shot in your last post is the GET call where I’m downloading the attachment from API #1. I then need to upload that attachment to API #2 using a PUT call.

I can successfully upload an attachment to API #2 using a PUT call I have setup using a http module when I hardcode the attachment being uploaded.

What I cannot get to work is using the data from downloading the attachment from API #1 and then using that data to upload in the PUT call to API #2.

The 1st picture below shows the data being downloaded from API #1.

The 2nd picture shows how the data needs to be formatted to successfully be uploaded to API #2 using the PUT call

I am almost certain that the data being downloaded from API #1 needs to be reformatted to be uploaded to API #2.

I have tried using the toBinary function in make with and without ‘base64’ denoted.

Just solved this. I needed to apply a base64 ( ) text function to the data downloaded from API #1 when configuring API #2

Heya @gregg_a welcome to the Make Community :wave: :make:

I just want to quickly say awesome work figuring this out with the guidance of @samliew :clap:

Thank you very much for keeping the community in mind and for stepping back in here to share what did the final trick for you. This could be incredibly helpful to many other users who are looking for the same info in the future :pray: