Help

Using the createField enpoint

Topic Labels: API
Solved
Jump to Solution
2435 4
cancel
Showing results for 
Search instead for 
Did you mean: 
xad9119
6 - Interface Innovator
6 - Interface Innovator

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!

1 Solution

Accepted Solutions
ScottWorld
18 - Pluto
18 - Pluto

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.

See Solution in Thread

4 Replies 4
ScottWorld
18 - Pluto
18 - Pluto

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.

xad9119
6 - Interface Innovator
6 - Interface Innovator

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!

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.

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: