Help

How to create new record with text of linked record rather than recordid?

Topic Labels: API
1756 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Helen_Kent
4 - Data Explorer
4 - Data Explorer

Hi,
I have two simple tables
votecount:

  • cityid (text e.g. ‘Birmingham’)
  • emails (linked to emails)
  • count (number)
    Screenshot 2021-12-04 at 21.43.30

emails:

  • emailid (number…)
  • email (email address)
  • votecount (linked to votecount table, displays the cityid)
    Screenshot 2021-12-04 at 21.43.18

On my react app, i want users to enter their email address and select their chosen city. I want to post that data to my airtable base. I’d like to simply post the email and the city name (not the linked record id) to the emails table.

Please could someone give me a hand with how to do that? I read something about typecast:true but i dont quite understand how that works.
Thank you

2 Replies 2
Joe_H
Airtable Employee
Airtable Employee

Hi Helen, welcome to the community!

I’ve added a sample body for a POST request below – with typecast, this should go ahead and populate the linked record based on the name. Does this help? If not, can you please paste a sample of the request body?

As a reminder, please be sure NOT to post any sensitive info, such as your API key, if you post a sample~

{
  "records": [
    {
      "fields": {
        "email": "example@gmail.com",
        "votecount": [
          "Leicester"
        ]
      }
    },
    {
      "fields": {
        "email": "example@gmail.com",
        "votecount": [
          "York"
        ]
      }
    }
  ],
  "typecast": true
}

That looks good, thanks Joe!