Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Mar 12, 2019 04:04 PM
This behavior started a couple weeks ago. Using Airtable’s airtable JS API v0.5.8, I used to be able to call update() successfully on table where the value for column to be updated was a javascript number.
Now it returns the error INVALID_VALUE_FOR_COLUMN. When I convert the number to a string before passing it into the update() call, it works.
Just a workaround FYI for others. It seems like is some stronger API checking going on on the Airtable server API side.
Mar 13, 2019 07:50 AM
Interesting—I wonder if this is a newly-introduced bug. Are you failing to update a number field with a number, or a number field with a string, or a text field with a number? (Or something else?)
Sample code and a description of the base would help us reproduce this so we can get this solved.
Mar 13, 2019 08:06 AM
@Case_Larsen - is it possible you forgot to use the {typecast:true}
feature in your recent calls?
Mar 13, 2019 02:18 PM
Here’s a repro case for a table with column “SingleLineText” which is of type single line text:
var Airtable = require('airtable')
var base = new Airtable({ apiKey: '<your key>' }).base('<your table id>')
base('Table 1').create({
'SingleLineText': 123
}, function (err, record) {
if (err) { console.error(err); return }
console.log('created', record.getId())
})
base('Table 1').create({
'SingleLineText': '456'
}, function (err, record) {
if (err) { console.error(err); return }
console.log('created', record.getId())
})
results in
created recc5jiGDbSGlpEsR
Class {
error: 'INVALID_VALUE_FOR_COLUMN',
message: 'Field SingleLineText cannot accept the provided value',
statusCode: 422 }
and resulting table having only one row with “456” in the SingleLineText column. i.e. the operation with 123 failed.
@openside I didn’t see typecast
in the documentation, and it had been working for a few weeks already as-is, but good to know.
As said, i think it’s probably increased API strictness (not a bug) which is ok, and the original request submitted an integer, not a string value, so I’d still need to cast values to a string before adding the typecast
directive.
Mar 19, 2019 05:04 PM
We’ll look into whether this is a bigger issue, so thanks for bringing this to our attention.
It sounds like your issue has been solved, which is great! Let us know if you run into any other issues (or if I misunderstood and your issue isn’t solved).
Nov 17, 2019 05:01 PM
Hi EvanHahn,
I have the same error today. The field type is Barcode (Named GTIN) and I have tried to insert the GTIN code (13 digits) as text and as number. The error is the same.
gdc
Nov 18, 2019 04:27 AM
I chaged the field type to ```
SingleLineText
Nov 18, 2019 07:41 AM
Could you include a code snippet of your problem (without your API key!) and the exact error you’re receiving?
Nov 24, 2019 05:59 AM
Hi EvanHahn,
I found out why I had the problem with barcode field.
I didn’t realize before that, the “barcode” type field is an array with two elements, one “type” and another “text”.
So the correct in my case (PHP) is:
$data = array(“fields” => array(“Product” => $p_Product, **
** “GTIN” => array(“type” => “”, “text” => “”.$p_GTIN), **
** “Value” => (0 + $p_Palue) **
** ));
This solve the problem.
I sugest that the error return array be more explanatory about the error and show the values received. This will help debug the problem. I saw that a lot of people asks about these API insert/replace errors.
Best
Nov 25, 2019 12:44 PM
We’ve thought about improving API error messages and will keep this in mind as we work on future versions—we’ll add this to the list. Thanks!