Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

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

Topic Labels: API
601 2
cancel
Showing results for 
Search instead for 
Did you mean: 

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

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!