Automatic ID [Jun 16]

:raising_hand_man: geocoast asked

Hello, I’ve not much experience so this might be simple but I have an json REST api that can successfully output data to nocodb but I can’t generate an “id” field to send (it is just a sensor outputting time and temperature). Is there a way to get nocodb to automatically generate the “id” or does the “id” have to be generated externally?

:person_tipping_hand: o1lab replied

when you create a table in nocodb - we generate an id which is set to autoincrement

:raising_hand_man: geocoast replied

Thanks for the response - my problem is that it seems nocoDB requires an “Id” field. I am using REST POST api from a source that can’t send an incrementing “Id” field just sensor values. If I try to send the JSON formatted fields without an “Id” field I get a 400 Error. I guess I’m asking if there is a way for nocoDB to work out that there is no Id value and automatically add one to inputs coming from the POST api. I can add a timestamp field as “Id” but that doesn’t seem to work. Any possible workarounds would be appreciated.

:person_tipping_hand: o1lab replied

can u pls confirm if you are using this api

:person_tipping_hand: o1lab replied

NocoDB API Documentation

:person_tipping_hand: o1lab replied

it works as you are proposing

:person_tipping_hand: o1lab replied

and wht are the error like on server side

:raising_hand_man: geocoast replied

Hi, yes that is the api I am using. I was trying to follow the example schema from the api documents:Example Value

Schema

{

“Id”: 0,

“CreatedAt”: “string”,

“UpdatedAt”: “string”,

“time”: 0,

“precipMax”: 0

}

:raising_hand_man: geocoast replied

However when I removed the “Id” and created/updated fields from the JSON I was sending and just sent the values the “Id” was correctly autogenerated. Seems like by adding the created/updated fields I was preventing the “Id” from being autogenerated. I’m sure this might be obvious to others but perhaps the example schema should not include the autogenerated variables? The link you sent about the api didn’t have these so perhaps they should be removed from the examples in the installed version NocoDB: API Docs. Again this may not be a problem for many users but may help inexperience ones like myself! Thanks again for helping to get me on the right path.

Autogenerated from discord


Join NocoDB’s community

DiscordTwitterRedditDocs