Where to add: "typecast": true (when column type is checkbox)?

I changed a column in Airtable from text to a checkbox (I am filling in with TRUE/FALSE (all caps)).

Now I get this when I try to insert:

  data: {
    error: {
      type: 'INVALID_VALUE_FOR_COLUMN',
      message: 'Field "Active" cannot accept the provided value'
    }
  }

I have seen articles saying to add:

"typecast": true

but this does not work. I’m not sure that I’m adding after the right curly bracket, as none of the articles I read are explicit on this, other than ‘add “typecase”: true’ somewhere.

I don’t know whether to add it after each fields entry like so, or somewhere else?

 {
   "fields": 
	{
		"key": "value",
		"key": "value"
	}, "typecast": true
 },

It is obviously being added in the wrong place, I am getting:

  data: {
    error: {
      type: 'INVALID_REQUEST_BODY',
      message: 'Could not parse request body'
    }

Is there an example JSON that anyone can share that has been successfully used here?

That looks [somewhat right except for that trailing comma seems out of place. But without seeing the actual payload in context that’s being sent in the API request, it’s difficult to say much. Often, errors are not what they seem.

I tried this again, looking at the placement of everything, and did find one correction that I made to reflect what I posted above.

I am still getting failures, but this time something different. I sent the JSON through a JSON validator, and it all checks out:

Sending: (this is cut-n-paste from my IDE, what I am sending - only key/value names have been changed, nothing else:

{ 
   "fields":{ 
      "key":"value",
      "key":"value"
   },
   "typecast":true
}

and I get back:

  data: {
    error: {
      type: 'INVALID_REQUEST_UNKNOWN',
      message: 'Invalid request: parameter validation failed. Check your request data.'
    }

The trailing comma in the original post is a separator for the next record, and would be needed if there is another record (set of fields) that follows (am sending 10 at a time), I strip off the last comma on the last record.

So Airtable does not like the placement of "typecast": true as is presented above, I’m not sure where it goes, or if it’s intended to work, but just does not work in this version of the API.

In my latest test, I am sending only one record (one set of fields), and getting this error.

This is probably not necessary as I think the JSON standard is to allow these trailing commas. But, until we’re sure the commas are not the issue, probably best to tidy the payloads.

Careful - the error is a bit more ambiguous than that. It doesn’t actually say that Typecast is the issue. As I said above - without seeing the actual payload in context that’s being sent in the API request, it’s difficult to say much.

Before I changed the column to a checkbox, I was passing “TRUE” or “FALSE” all upper case with quotes, and then began to play with typecast, never got anything to work.

After much experimenting, I got this to work by doing three things:

1. remove typecast, don't use it, delete it
2. Remove the quotes on the value being passed "TRUE", "FALSE", 
3. just pass (all lower case) true or false

==> Passing upper case TRUE or FALSE as a boolean value fails,
==> Passing as String (enclosed in quotes) fails.

It works like so:

{ 
   "fields":{ 
      "key1": "value",
      "key2": true,
      "key3": false
   }
}

@Dev_Local, glad to hear you got it working. I’ve revised your list of things to do to get stuff working:

  1. always share the exact payload that’s triggering the issue because other members will likely spot issues such as “TRUE” passed as a boolean value and save you big headaches. :wink:

  2. remove typecast, don’t use it unless there is a good reason to use it

  3. remove the quotes on the value being passed “TRUE”, “FALSE” (if - and ONLY if - the target field requires a boolean value)

  4. just pass (all lower case) true or false (if - and ONLY if - the target field requires a boolean value)

Thank you, I did try to be as thorough as possible in my original question/post.

Your initial comments were helpful and led to the solution, it put the thought in my mind to look at all possible things that could be wrong instead of focusing on typecast, and I quickly saw the issue.


Others have posted in the community forum with similar issues, and it was the answers and thread there that led me to thinking I needed typecast.

There was never a final resolution on the posted issue of what ultimately worked, misleading and dead end.

If I post, (or anyone does), the final resolution, as was done here, would be super helpful to others. Thank you.

1 Like