Retuning data based on a max value from Bubble api

Hi every one! i have an api call which returns “data: A, score:1”, data:B, score2", etc. Does anyone have any recommendations on how i get the value for data based on the max score value?


Are the data and the score returned separately and respectively? Or are they returned as one whole piece of text?

If it is the first case you can create a data type that has two fields: text for data and number for the score. Return the response into the database with that particular data type. Then it is easy to search for the max score and the corresponding variable.

For the second case you might need a data parser, or some sort of plugin that helps you extract information.

Here is a possible plugin you can use: Text Analysis Plugin | Bubble
Try the data call for “Analyze Syntax”.

Thanks Ada. So the api returns a json like this
In this case, would I be able to save all the data fields and score fields in the database and also pull up the corresponding data value for max score? Thanks!

That is perfect if the response is in JSON.
You just need to:

  1. Create a new data type (or modify your current data type)
  2. Create two new fields: one in the type of your data (let say text); one in number
  3. Construct the workflow to write the data into the text field, the score into the number field (one at a time with probably the “Create a new thing…” action)
  4. Then you will have everything stored in your database

To pull the max score out:
Just simply use “Do a search for…” function and find the entry with the max score. And use the entry at wherever you need.


Awesome! Thanks so much!