Upload image in binary with a rest query

Hi, I'm working with the dropbox api and my goal is to upload an image from the imageInput component on mobile. When i select the binary option and i run the request i get the "Cannot destructure property 'data' of 'base64Data' as it is undefined." Even if the body is empty. I tryied with RAW also but didn't find a solution.

Here's how the API works.

Hello @titouan!

Could you provide screen shots with the example binary/payload you were trying to put in the body?

Is it a full binary string or an object to send as a file attachment as shown in the example in your second screen shot?

This might be an issue with Dropbox or how you are sending data to their API, have you been able to upload images to this URL outside of Retool?

Check out Dropbox's documentation here for more details on if that is the correct route for your use case and see if they have examples on how to hit said endpoint.

This should further specify how they want the request body to look and if you need to unencode after encoding with base64.

I didn't manage to upload images to dropbox with the /files/upload route, instead I uploaded the images on the retool storage then took the public link and used this route : https://api.dropboxapi.com/2/files/save_url which takes more times but it's working.

I tried with a lot of format but there's not documentation about which one should be used so i won't be able to tell you which one I used exactly.

@titouan glad to hear you were able to get it to work!

Could you elaborate more on what docs you would like us to add? Are you referring to how Queries send data to a dropbox Resource?

Any screenshots you could provide on how you got the query to work and the error message you are getting from dropbox would also be very helpful for us to troubleshoot why the 'base64Data' might be showing up as undefined!

It could be nice to explain how to upload files with the binary option selected and why not do it with the dropbox API. The query didn't work, I used a different one as a explain in the previous message. Sorry I can't provide you a screenshot.. Thanks for you help !

@titouan thank for you for the info!

I was looking around and can't seem to find any docs on Retool integration with Dropbox, so that is something I can definitely bring up to our team.

Glad the workaround is able to accomplish the task. From the documentation I was able to find on uploading images, it seems that the current best practice is to do exactly what you did.

First upload to Retool Storage/AWS S3 bucket, get the URL and then send the URL to where you want the image to end up. As outlined in the docs here for mobile image uploads. Not sure why the error is saying it can't access the body payload.