Skip to main content
Solved

Using the createField enpoint

  • November 15, 2022
  • 4 replies
  • 31 views

Forum|alt.badge.img+8

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!

Best answer by ScottWorld

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.

4 replies

ScottWorld
Forum|alt.badge.img+35
  • Genius
  • 9808 replies
  • Answer
  • November 18, 2022

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.


Forum|alt.badge.img+8
  • Author
  • Known Participant
  • 12 replies
  • November 18, 2022

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!


Forum|alt.badge.img+12
  • Known Participant
  • 10 replies
  • November 19, 2022

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.


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.


ScottWorld
Forum|alt.badge.img+35
  • Genius
  • 9808 replies
  • November 20, 2022

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: