Nov 15, 2022 01:33 AM
Hi everyone,
I’m trying to build rollup fields using the enterprise api endpoint listed here. But I keep getting 422 errors, even when I try to create basic fields such as auto numbers.
Here’s an example of the data I’m sending
var url = "https://api.airtable.com/v0/meta/bases/baseId/tables/tableId/fields"
var data = {
"name": `q_2-1-test`,
"description": `Random desc`,
"type": `rollup`,
"options": {
isValid: true,
recordLinkFieldId: `fldhDkHwnD45oCZq6`,
fieldIdInLinkedTable: `fldn0niuiFhkEuyF2`,
referencedFieldIds: []
}
};
I’m a little confused by the referencedFieldIds property, I’m not quite sure what should be specified here. I have used the Script Interface to see what was referenced here on an existing rollup field, but here is what I got:
{
isValid: true
recordLinkFieldId: "fldhDkHwnD45oCZq6"
fieldIdInLinkedTable: "fldn0niuiFhkEuyF2"
referencedFieldIds: Array(0)
result: Object
type: "singleLineText"
}
Thanks a lot for your help!
Solved! Go to Solution.
Nov 17, 2022 07:53 PM
The documentation on the page you linked to makes it seem like you can create any field type via the API, but the documentation is misleading.
You can not create (i.e. write to) fields that are formula-based fields, such as rollups. Those are not considered “writeable fields”.
On this page, it lets you know if fields are “writeable” or “readable” or both.
I’m tagging @SeanKeenan to see if he could clarify the documentation on the page you referenced.
Nov 17, 2022 07:53 PM
The documentation on the page you linked to makes it seem like you can create any field type via the API, but the documentation is misleading.
You can not create (i.e. write to) fields that are formula-based fields, such as rollups. Those are not considered “writeable fields”.
On this page, it lets you know if fields are “writeable” or “readable” or both.
I’m tagging @SeanKeenan to see if he could clarify the documentation on the page you referenced.
Nov 17, 2022 11:44 PM
Hi @ScottWorld
Thanks a lot for your answer, that’s what I thought looking at other parts of the documentation.
That would be great to have the ability to fully configure bases, tables views using the API, hopefully that will become available one day!
Nov 19, 2022 03:41 PM
Thanks @ScottWorld for answering this!
I’ll add on that the linked docs are no longer going to be actively updated (there should be a banner at the top redirecting you to the :sparkles: new docs :sparkles: ).
For the endpoint that you’re interested in, hopefully this page makes it clearer that it doesn’t apply to all fields.
This page goes into more details on all of the fields and if they can be written to, read from, etc.
Nov 19, 2022 04:25 PM
Thanks so much for the updates, @SeanKeenan! :slightly_smiling_face: It seems like there is a typo on this page… it refers to the “Number” field as an “Integer” field: