# Given “App Type”, Retrieve Field Info?

**URL:** <https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237>\
**Category:** Plugin builders\
**Created:** [July 21, 2019, 1:18pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237 "2019-07-21T13:18:38Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudsy](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sudsy/32/114637_2.png) [@sudsy](https://forum.bubble.io/u/sudsy)\
**Post date:** [July 21, 2019, 1:18pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/1 "2019-07-21T13:18:38Z")

</div>

Is there a way to get a list of field names for a “Thing” given the “App Type” (type of Thing)?

I noticed that an App Type property in the editor’s property panel is available to a plugin as a string in the form “custom.apptype”. Can information about the structure of a Thing be retrieved using that string?

Specifically, I’d like to get the name and label for the fields comprising the Thing. I don’t need data values – just the field names (internal) and labels (user-facing).

---

<div class="post-metadata">

**Author:** ![hernanojedapeletti](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hernanojedapeletti/32/46911_2.png) [@hernanojedapeletti](https://forum.bubble.io/u/hernanojedapeletti)\
**Post date:** [November 19, 2019, 4:39pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/2 "2019-11-19T16:39:11Z")

</div>

Estoy buscando lo mismo, mi consejo es que por ahora utilices API connector y realices un get de tus datos (debes habilitarlo en settings/api)

[https://myapp.bubbleapps.io/api/1.1/obj/field](https://myapp.bubbleapps.io/api/1.1/obj/field)  
[https://myapp.bubbleapps.io/version-test/api/1.1/obj/field](https://myapp.bubbleapps.io/version-test/api/1.1/obj/field)

saludos espero ayude

---

<div class="post-metadata">

**Author:** ![launchable](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/launchable/32/91733_2.png) [@launchable](https://forum.bubble.io/u/launchable)\
**Post date:** [September 29, 2023, 8:29pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/3 "2023-09-29T20:29:31Z")

</div>

Also wondering about this. Bumping the thread in case anyone has solved this.

What I’m wondering about specifically is this:

- If you define a field as App Type
- then define another field that is Fields of {your custom app type}
- Then you can get the field name into the JS context.
- But it won’t match the full, properly-cased property name you’d see in the database, and (more to the point for what I’m working on), this means it also won’t match what’s expected by the Data API Bulk create endpoint.

This seems odd to me. If you field is “Name”, for example, you need to use “Name” with the data api. But if getting a user to specify Type/Field names, ie using the plugin to get App Type → Fields of app\_type, you’ll get “name\_text”, which you can’t then use to access the Data API.

Is there some other way to get the “proper” field names out via a plugin action? Or is the only way to do this by specifying specific records of that type, then using .listProperties() ?

---

<div class="post-metadata">

**Author:** ![sudsy](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sudsy/32/114637_2.png) [@sudsy](https://forum.bubble.io/u/sudsy)\
**Post date:** [September 29, 2023, 8:46pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/4 "2023-09-29T20:46:16Z")

</div>

> [@launchable](#):
>
> using the plugin to get App Type → Fields of app\_type, you’ll get “name\_text”, which you can’t then use to access the Data API.

Does it work if you uncheck the following option under **Settings** → **API** …

 ![data-api-field-name](https://us1.discourse-cdn.com/bubble/original/3X/b/0/b0ffca9889f3c0e403ff1b43542c3e70c77f2fd6.png)

---

<div class="post-metadata">

**Author:** ![launchable](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/launchable/32/91733_2.png) [@launchable](https://forum.bubble.io/u/launchable)\
**Post date:** [September 29, 2023, 9:50pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/5 "2023-09-29T21:50:29Z")

</div>

Ohhhh…. Brilliant! I’ll check that out later. Thanks @sudsy !

---

<div class="post-metadata">

**Author:** ![Zeroic](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zeroic/32/246980_2.png) [@Zeroic](https://forum.bubble.io/u/Zeroic)\
**Post date:** [June 3, 2025, 3:59pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/6 "2025-06-03T15:59:05Z")

</div>

Did you find a fix for this issue? I’m trying to basically fetch the data types of all the fields within the object specified by the **App Type** so that I can return the right kind of data. I receive **null** (from an API call being made in the plugin) in case these fields are empty and there’s no way to know whether it needs to be formatted as a string, as a number or an array

---

<div class="post-metadata">

**Author:** ![boston85719](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/boston85719/32/77286_2.png) [@boston85719](https://forum.bubble.io/u/boston85719)\
**Post date:** [June 3, 2025, 4:29pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/7 "2025-06-03T16:29:52Z")

</div>

> [@Zeroic](#):
>
> I’m trying to basically fetch the data types of all the fields within the object specified by the **App Type** so that I can return the right kind of data.

So you are trying to figure out given the app type what are the different types of fields used, such as text, date, number or date range?

If so, when running the get properties functions you should be receiving the field name and a prefix or maybe a suffix that would indicate what type of data field it is.

> [@Zeroic](#):
>
> I receive **null** (from an API call being made in the plugin) in case these fields are empty and there’s no way to know whether it needs to be formatted as a string, as a number or an array

What is the use case?

---

<div class="post-metadata">

**Author:** ![Zeroic](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zeroic/32/246980_2.png) [@Zeroic](https://forum.bubble.io/u/Zeroic)\
**Post date:** [June 3, 2025, 8:21pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/8 "2025-06-03T20:21:59Z")

</div>

> [@boston85719](#):
>
> So you are trying to figure out given the app type what are the different types of fields used, such as text, date, number or date range?

That’s right

> [@boston85719](#):
>
> If so, when running the get properties functions you should be receiving the field name and a prefix or maybe a suffix that would indicate what type of data field it is.

I just receive a string of the app type. For ex: If it’s an option set, on printing the property holding the app type, I get a string saying option\_set.\<some\_value\>; similarly api\_connector.\<some\_value\> for custom types and so on

> [@boston85719](#):
>
> What is the use case?

I’m getting data from an external DB and the dev has an option to specify the return type. Now, when data is being returned from the DB, it returns null for those fields that are empty. Which means, null for primitive as well as arrays, jsons etc

If I publish the value, I get an error from Bubble saying that the value is not iterable. If I knew that the field is defined as a list, I can replace null values with empty arrays for those fields.

I saw that the Xano plugin too has this issue as shared by @eli on the Forum, but was wondering if there’s a way yet to do this

---

<div class="post-metadata">

**Author:** ![boston85719](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/boston85719/32/77286_2.png) [@boston85719](https://forum.bubble.io/u/boston85719)\
**Post date:** [June 4, 2025, 4:32am UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/9 "2025-06-04T04:32:47Z")

</div>

> [@Zeroic](#):
>
> api\_connector.\<some\_value\> for custom types

the _api\_c2_ is for api connector objects, which if the data you are receiving is from an external database connected to bubble app via an API, that is not a custom data type (ie: a data type created in the Bubble database), that is instead an api object.

When you initialize an api call in api connector, as you have likely done for the api to the external DB, you will specify what type of values those correspond to within your Bubble app, which can be option sets, basic types (text, number) or plugin data types (encompasses both api connector objects and plugin objects), but it is not possible to initialize those as a custom data type (we literally do not have our custom data types as options to choose from).

When you initialize the payload can have the values properly formatted to be null of the correct type of data.

 ![Screen Shot 2025-06-04 at 11.25.53 AM](https://us1.discourse-cdn.com/bubble/original/3X/a/e/ae97bd710b9f5f1b706219364cb74a3badf19859.png)

And then choose from the right dropdown what type of data it is. That is how Bubble will know when a plugin fetches a list of that type of api connector object what type of data it is.

If your source is sending just an empty string, that I believe is where the fix needs to be, which is to say that you either send in the correct form of empty values for that type of data or just know when initializing the api call and to set the value to the right type during initialization.

Once you do that, then anytime in Bubble, anywhere you use an expression to reference that type of api connector object (ie: the values coming from the external db api call) and you want to feed it into your plugin (the one you need to know the type of data for), you do not need the plugin to do the heavy lifting of figuring out what type of data is it, and instead let Bubble do it via the dynamic expression and for some types of values you’d use ‘formatted as json safe’, but unfortunately, Bubble doesn’t provide that formatting option for numbers which is a pain as we are then forced to do ridiculous things like provide a ‘inline conditional’ to determine if it is empty or not so we can use the yes/no options inputs to format with ‘null’ or the actual number (formatted as json safe for numbers should exist so that if it is empty bubble sends ‘null’).

> [@Zeroic](#):
>
> If I publish the value, I get an error from Bubble saying that the value is not iterable. If I knew that the field is defined as a list, I can replace null values with empty arrays for those fields.

You are saying when you use your plugin to try and fetch the data, you get an error stating the value is not iterable as in it is not an array and can not be iterated on from one item to the next? If so, that might not be the issue of the type of data being known, it might be an issue with the plugin function and how it is attempting to fetch the data.

---

<div class="post-metadata">

**Author:** ![Zeroic](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zeroic/32/246980_2.png) [@Zeroic](https://forum.bubble.io/u/Zeroic)\
**Post date:** [June 4, 2025, 10:17am UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/10 "2025-06-04T10:17:36Z")

</div>

> [@boston85719](#):
>
> that is not a custom data type (ie: a data type created in the Bubble database), that is instead an api object.

Yes, this is what I meant. I manually insert the API response and save that by specifying the primitive types for each field in the API connector; and then pass that to the App type parameter in the plugin.

> [@boston85719](#):
>
> If your source is sending just an empty string

This source sends back null **only** when the value there is empty. If it’s populated, it’s fine which is why the below comes up

> [@boston85719](#):
>
> You are saying when you use your plugin to try and fetch the data, you get an error stating the value is not iterable as in it is not an array and can not be iterated on from one item to the next?

Since the array field is empty for that record, it returns null from the source (unless, ofc, I set the default value to `[]`), and null isn’t iterable, which is why I get this error. If I knew the data types of the attributes within the App Type, I could’ve handled this as an array and published to the plugin’s state accordingly.

---

<div class="post-metadata">

**Author:** ![ihsanzainal84](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ihsanzainal84/32/245932_2.png) [@ihsanzainal84](https://forum.bubble.io/u/ihsanzainal84)\
**Post date:** [June 4, 2025, 12:20pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/11 "2025-06-04T12:20:18Z")

</div>

> [@Zeroic](#):
>
> Since the array field is empty for that record, it returns null from the source (unless, ofc, I set the default value to `[]`), and null isn’t iterable, which is why I get this error. If I knew the data types of the attributes within the App Type, I could’ve handled this as an array and published to the plugin’s state accordingly.

Have you tried reworking your code to turn all returned values into an array and publish them as list states by default? So regardless if it’s a scalar or array the state is alwqys an array. Then retrive any scalar values with first item in Bubble.

Not sure if my point is clear haha.

---

<div class="post-metadata">

**Author:** ![Zeroic](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zeroic/32/246980_2.png) [@Zeroic](https://forum.bubble.io/u/Zeroic)\
**Post date:** [June 4, 2025, 7:49pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/12 "2025-06-04T19:49:20Z")

</div>

I’ve defined the type of the fields as singular values in Bubble via the API connector. If I return arrays, I’ll get an error saying that Bubble was expecting a string or a number but got an object

The idea is for users to define their own datatypes so I wouldn’t expect them to convert all the attributes to be a list of things tbh

---

<div class="post-metadata">

**Author:** ![ihsanzainal84](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ihsanzainal84/32/245932_2.png) [@ihsanzainal84](https://forum.bubble.io/u/ihsanzainal84)\
**Post date:** [June 4, 2025, 11:34pm UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/13 "2025-06-04T23:34:10Z")

</div>

I think I’m missing something here. How is the API Connector interacting with your plugin exactly?

As hinted by @boston85719, If you’re taking the returned values from an API call wouldn’t you already know the schema of the JSON you’re processing in your plugin? 🤔

Have you tried using the listProperties() method on a user property? Pretty sure the suffixes will state what type of data each field is.

---

<div class="post-metadata">

**Author:** ![boston85719](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/boston85719/32/77286_2.png) [@boston85719](https://forum.bubble.io/u/boston85719)\
**Post date:** [June 5, 2025, 3:39am UTC](https://forum.bubble.io/t/given-app-type-retrieve-field-info/62237/14 "2025-06-05T03:39:02Z")

</div>

> [@ihsanzainal84](#):
>
> Have you tried using the listProperties() method on a user property? Pretty sure the suffixes will state what type of data each field is.

Does that work for custom data types and api objects? I am not sure but I think only fields of a custom data type have the suffixes applied to denote what type of data it is.

> [@Zeroic](#):
>
> The idea is for users to define their own datatypes so I wouldn’t expect them to convert all the attributes to be a list of things

How are the users defining their own data types? Is this supposed to happen in your plugin or be somewhere else and provided as a field value to your plugin?

> [@Zeroic](#):
>
> I’ve defined the type of the fields as singular values in Bubble via the API connector.

In an app or in the plugin editor?

> [@Zeroic](#):
>
> Since the array field is empty for that record, it returns null from the source

This is from ChatGPT

> In JSON, `null` and `[]` are not the same thing:
> 
> - `"key": null` means “there is no value here” (the value is explicitly null).
> - `"key": []` means “the value here is an array, and it currently has zero elements.”
> 
> If your intent is to send an _empty array_, you should use:
> 
> json
> 
> CopyEdit
> 
> ```auto
> "key": []
> 
> ```
> 
> If you send `"key": null`, most JSON‐parsers will treat it as “no array at all,” not “empty array.” Use `null` only if your schema (or your receiving code) specifically allows for “no value” rather than “an empty list.”

Which from my experience is how to initialize an empty array in api connector. The screen shot I shared in previous reply with list\_text(list) was initialized with `"list_text": []` in order to get the key initialized as a list of text.

So, my thought here is if your source is out of your control and the source provides just null then it would likely be safe to assume it is a single string and not a list, but if the source is providing those values properly, an empty list would be `[]`from the source and understood properly by other systems as an empty list, I think.
