Skip to main content

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

  • December 4, 2021
  • 2 replies
  • 18 views

Hi,
I have two simple tables
votecount:

  • cityid (text e.g. ‘Birmingham’)
  • emails (linked to emails)
  • count (number)

emails:

  • emailid (number…)
  • email (email address)
  • votecount (linked to votecount table, displays the cityid)

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

Forum|alt.badge.img+5
  • Participating Frequently
  • 7 replies
  • December 14, 2021

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
}

  • Author
  • New Participant
  • 1 reply
  • December 15, 2021

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!