Select id as text, not auth
Hi,
I am trying to set id as text. However, Xano automatically takes it as if it was an "auth" value, which it isn't. What can I do for it to stop taking it as auth? I already tried typing "id" into the text box, did not work.
Thanks
Best Answer
-
Hi @pachocastillosr select "text" from the drop-down instead of auth for ID.
Answers
-
"id" is a reserved field name in Xano. All tables have an integer "id" field auto-managed by Xano which you can't delete.
There is an "id" value under the "auth" section that you can assign to any variable but, again, it's an integer referencing the primary key (id field) of the table you are using for authentication.
-
@arturosanz thanks for replying!
What if I am calling an external api which returns a field "id"? I wouldn't be able to reference it in any way then?
I need to unset this "id" field from this json: -
If this is true that there is no way to reference a field "id" in a json because it is reserved by Xano, this might be something important to fix.
There are many json objects received by external apis (not in our control) that use that path and it would be terribly obstructive not being able to reference it. @Michael Udinski @Lachlan
I would appreciate any help, maybe there is a workaround or something I'm not seeing. Thanks! -
Whatever you get from an external API is saved into a variable in Xano, but a variable is just a temporary space in memory, not a table or field which are meant for permanent storage entities. Each table in Xano has an internal "id" field, but this doesn't affect variables.
You can use and reference external APIs "id" fields, which aren't true fields, but just elements of an object variable, without limitations. They can be integers, text, or whatever the external API established for them.
What you shouldn't do is to transfer directly the external API response to your Xano permanent storage (tables) mapping all fields without adapting the "id" key first, if needed.
For instance, if the external API has an integer "id" in theory you could safely force Xano to save it in the reserved "id" field, probably losing the auto increment feature afterwards.
However, if the external API has a text "id" instead, you can't save it in Xano's integer id field, but you can add another unique "id_api" text field to the table, index it if you need to, and use it. Your table will have two fields, Xano's "id" which is the primary key, and the external API "id_api".
Xano needs the internal "id" fields in all tables, which are the primary keys, to establish relationships among tables. Xano decided to use unique integer values starting from 1 for those primary keys. It's the simplest way to understand a primary key for customers too.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback