How to save text (from external API) in an Option-Set Datafield?


I am looking for a way to save text (that I retrieve from an external API) into a data field with Option-Set as datatype. Has anyone experience with a workaround for that?


If you mean updating an option set then that can only be done from the editor. There is no way yet to update or create option sets otherwise.


Thanks for the answer @mmahirf. If I can’t update an option set, is there a way to safe the value that I’ve returned from the api call directly in a datafield (which has a option set as a field type)?

My usecase: I have dropdown (dynamic choices, choice type is a option-set). As default value I want to show the value I returned from an api call.

So it’s just the default value that you need shown from the api call? Does it need to be able to be selected after? If so then you will need to use a data type instead of an option set.
If it’s just a static default value then you might need to play around a bit. Maybe you could use a conditional that changes the data source to something else.

Exactly, I need just the default value. In best case you should be able to select it. I’ll try to find a solution with conditionals. Thanks

If you want to change the data type of the result of an API call:

  1. Initialize the API
  2. A popup will appear to confirm the type of data type
  3. Select in a dropdown the data type you like => it can be an option set
  4. Save

You’re done! Now Bubble will return an option set in the results of the API call

Be careful: The text sent by the API must be exactly the text indicated in the Display field of the option set, otherwise Bubble won’t be able to match the text with the option set.

Note: This search can be done with a workflow or on a page, but it’s much longer and therefore less efficient.


1 Like

hey @devease Does this work? I ask because it hasn’t worked for me in the past.

I recently reached out to bubble about this. When i define returned data in an API as an option set, on the page i could still only use it as text, not an option set.

They said that was correct and they’ll look at implementing this.

Does it work now?

If it doesn’t, you can grab all the options and filter the display to the api returned text, but obviously, we’d like to skip this part!

hey @andy.i , sure it works :wink:
You can test on this page (username/password):
Dropdown is option set.

There is an option set “language”:

The data type “test” contains the “language” option set:

Then the API call is set to return the option set “language”:

Finally get the data on the page filtering with the option set:

Et voilà! :slightly_smiling_face:

Note: Of course, to make it more secure and efficient, filtering directly when making the API call is better than client side.


1 Like

@devease awesome, thanks for the run-through.

I’ll re-visit my setup and give this another go!

Merci beaucoup!

This is exactly what I am looking for. Thank you!