Attempting to make a dynamic cURL request using Bubble

I am trying to create a cURL request similar to this where there can be a variable number of classes and the names can be different.

This is using IBM Watson Visual Recognition.

Here is an example of what I am trying to implement:

curl -X POST -u "apikey:{apikey}" \
--form "beagle_positive_examples=@beagle.zip" \
--form "husky_positive_examples=@husky.zip" \
--form "goldenretriever_positive_examples=@golden-retriever.zip" \
--form "negative_examples=@cats.zip" \
--form "name=dogs" \
"https://gateway.watsonplatform.net/visual-recognition/api/v3/classifiers?version=2018-03-19"

I want the user to be able to set the name of the different positive_examples.
The different zip files will be uploaded by the user.

How should I go about this with the API Connector.

Thank you.

Have you seen this?

Bubble Webinar 2 - The API Connector - YouTube

No - thank you for pointing me to this resource. I’ll be taking a look at it once i get more time.

I took a look at it and it does not address the issue that I have. I cannot upload files using dynamic JSON body, which is a necessary functionality.

How exactly they want those files? As URLs, base64…?

Those files would be ZIP files uploaded by the user.

But you’ll send what kind of “Data type” on Bubble? “File” data type?

Yes - all of the values that start with “@” refer to ZIP file, which would be a File data type.
However, the names of the keys and the lengths of the keys should be editable.

Thank you so much!

I think that you just need to use the file url and append https: to because bubble doesn’t add it.
You can edit the key using the same pattern [key] that you use for the file. I suggest to have it like [positive_examples containe]_positives_examples=[file url]

I check a little bit more the watson API and finally not sure you can only send the url actually.

I am not sure that I completely understand you.

It is unlikely to work, as the files need to be binary. Pointing it at a URL an hoping it will convert to Binary is hope over adversity :slight_smile:

What you can maybe do is use the Watson Node sample and create a Server Side plugin.

I have a similar issue with getting a binary image to a twitter API for upload.

cUrl and Postman both do the binary conversion for you. Bubble does not seem to want to.

2 Likes

Thank you so much, NigelG. I will take a look at what you have referred to.