Create a model with fields?

Is it possible to create a new model via the REST API, and at the same time, define the multiple fields it should have?

What I’m trying to do is convert a block to a model. I can retrieve the block and get its fields, like:

"data": [
                    {
                        "id": "7149005",
                        "type": "field"
                    },
                    {
                        "id": "7149007",
                        "type": "field"
                    },
                   (etc.
 ]

But the same data format can’t be used to create a new model with the fields intact. The API rejects it:

“#/data/relationships: failed schema #/definitions/item_type/links/1/schema/properties/data/properties/relationships: “fields” is not a permitted key.”,

Is the only way to programmatically add fields to a new model looping through them one at a time, waiting for the job response each time? There isn’t a way to define a model and fields in one request?

Thanks!

1 Like

Hello @roger

The only way to define fields for now is one per request, we currently don’t have a way to create fields in a bulk, unfortunately.
So the looping you mentioned is indeed the only possible way to do it at the moment.
But it would be a very good feature request, as i can see it is a much more intuitive and simple way of defining a model

Best,

Got it, thanks! Made a feature request.

1 Like