Oct 27, 2019 09:24 PM
I’m receiving a 422 error when I send a POST request to create a new record. I believe this is due to a specific field.
When I submit a POST request with the following data:
data = {
"records": [
{
"fields": {
"access_key": "an access key",
"user": [
"rec123ABC"
],
"server_name": [
"rec456DEF"
],
"Status": "Live"
}
}
]
}
The request successfully goes through.
However, if I add the following field to the data request:
'outline_id': 3
,
I receive a 422 response.
outline_id is a new column that I’ve recently created. It is in Integer format.
Additionally, when viewing my API documentation for my base called ‘access_keys’, table called ‘access_keys’, I see that under the ‘Create records’ documentation, the outline_id
column is not shown in the example, even though all of my other fields are shown.
The outline_id
column is also not shown under the ‘Update records’ section.
Oct 29, 2019 03:15 AM
Sorry if I’m stating the obvious, but refresh your API documentation page and you should see the new field. It doesn’t auto-refresh when a new field is added to a table.
JB
Oct 29, 2019 04:18 AM
Appreciate the suggestion. You’re talking about a simple browser refresh, yes? Doesn’t solve the issue, unfortunately.
By ‘…a new column that I’ve created recently’, I mean a few weeks ago. Docs should be updated to reflect the change by now, yes?
Some further investigation:
If I create a new column in Airtable GUI (say test_column
), and refresh the docs, I see the new column in the Fields
section. However, I don’t see it show up in any of the remaining examples under Retrieve a record
, Create record
, or Update records
. Perhaps the examples are based on a cached version of the table?
When testing this against other bases that I manage, I see the same bug. New columns appear under the Fields
section, but not subsequent examples.
Oct 29, 2019 07:40 AM
If a field doesn’t appear in the API documentation, it may be because we don’t have any sample values to use. Try adding some sample values to your table in the offset_id
field to see if that makes it show up in the API documentation.
If that doesn’t help, what error do you receive from the API? I know that you get a 422 error, but what does the response body contain?
Oct 29, 2019 08:37 AM
Hi, I’ve found the error. It was a mistake on my behalf. I didn’t load in the variable as an integer in Python. I’m able to create new records with values for the outline_id column now (by converting the value into an integer first).
W/ regards to the documentation sample: I do have data loaded in the column. Still wondering why the documentation doesn’t reflect the new columns?
Anyways, my issue is resolved now. Thanks for your suggestions.
Oct 29, 2019 08:49 AM
Glad your issue is resolved.
It’s possible that the sample data isn’t in the right place. I don’t 100% remember how we choose sample values for the API documentation, but I believe we show sample data from the first two or three records in the table. Maybe ensure that the first few records have sample data. (Again, that may be wrong.)
Oct 29, 2019 05:42 PM
Maybe ensure that the first few records have sample data. (Again, that may be wrong.)
Just tested this. Yes, previously my outline_id
column had some values, but not in the first few rows. After I added dummy integer data in the first few rows, the outline_id
field showed up in the API documentation.
Thanks!