Forum Academy Marketplace Showcase Pricing Features

Dynamic values for an API?

Hey Bubblers, hopefully I have something here that can be made simpler.

I have an API POST method that sends data to an API which then returns data. Cool. Not an issue.

Right now it’s currently set up in a text/RAW format, using the _*_ code to allow me to add dynamic data. Very easy!

It looks like this:

{"price":{"0":_*_priceValue1_*_, "1": _*_priceValue2_*_, "2": _*_priceValue3_*_, "3": _*_priceValue4_*_, "4": _*_priceValue5_*_, "5": _*_priceValue6_*_, "6": _*_priceValue7_*_, "7": _*_priceValue8_*_, "8": _*_priceValue9_*_, "9": _*_priceValue10_*_, "10": _*_priceValue11_*_, "11": _*_priceValue12_*_, "12": _*_priceValue13_*_, "13": _*_priceValue14_*_, "14": _*_priceValue15_*_},

As you can see, that’s a lot of data values we have to manually enter! (Both the index of the array, and then its corresponding data).

What’s even crazier is this is the process for only ONE item that we’re sending through to the API.

Well, what happens when we want to send in two items? We have to hardcode the values to be even MORE: “15”: priceValue16, “16”: priceValue17, “17”: priceValue18… all the way to 30.

Yes, it takes 15 values for each item. So, four items would be 60 hardcoded values!

My question is:

Is there ANYWAY to make this dynamic?

To clarify, we have to enter in the index of the array for each item, and then we need to add the value. For every item/value.

We have discovered the above method works and this can be done if we hardcode the values, but is there anyway to make this dynamic or is this a Bubble limitation? I can absolutely 100% provide more clarification where needed, just let me know! Thanks :slight_smile:

In the API connector I assume you are sending this through as json body parameters.

If the issue is getting the API initialized, you should set it up in the initialization as a single value but with the proper json formatting.

Then when you send the values use the format as text operator to send through the array of values.

Learn More

Boston85719 is an expert Bubbler with a decade experience as an educator. Real name Matthew, he has been actively building SaaS apps, marketplace apps, scheduling apps and more for clients, himself and for sale as templates.

As an official Bubble Bootcamp Instructor, he leads Bubble Bootcamps on a regular basis.

Always willing to offer advice via the Bubble Forum, Matthew also offers Private Personal and Group Training Sessions.

Through his site, NoCodeTrainer, Matthew provides a range of tutorials with editor access to help you jumpstart your Bubble development.

Always accessible you can send Matthew a private message via the forum or send an email directly with your requests.

Be sure to checkout the Stripe Integration Course when you are ready to integrate Stripe payments to start monetizing your application via product sales or subscriptions.

Stripe Integration Course

NoCodeTrainer.com