Using the createField enpoint

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!

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.

2 Likes

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!

1 Like

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.

1 Like

Thanks so much for the updates, @SeanKeenan! :slight_smile: It seems like there is a typo on this page… it refers to the “Number” field as an “Integer” field:

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.