Cannot create row with reference field with ID thru API

hello :grinning:,
I have a table Shop
and I decided to display the name of the country to make it easier to the user.
But with that, I cannot create a row thru the API using the ID of the country.
I have to use the name as a string “France” to make the request working.
Is that how it’s suppose to work ?

class Shop:
  name = grist.Text()
  url = grist.Text()
  country = grist.Reference('Country')


Previously, most people had the opposite problem and couldn’t understand why they had to send a number instead of “France” :smile:

So we made the API interpret strings according to the selected “Show column”, i.e. ‘name’ in this case. You can either:

  1. Tell n8n to interpret “Field Value” as a number instead of a string, so that the JSON says "country": 1 (no quotes) instead of "country": "1". Not sure if they actually allow this.
  2. Change the “Show column” to Row ID, in which case it should parse strings containing numbers the way you want. You can then use a formula column to display the name. But I know that’s not great either.
1 Like

haha oki I see :smile:
yeah it’s just because “Row ID” will never change unlike other fields, otherwise, the day I change the “SHOW COLUMN”
the API will fail ^^’
And if I change the “Show column” to Row ID, I won’t have the list with the name.
Concerning n8n, you were right,
by doing “{{parseInt(“1”)}}”, it’s working perfectly, thank you :wink: