How to manipulate the Appearance Section of a field through Script -javascript code

Hello Everyone,

I wrote this content-management script to create a content type through CLI. everything works well as expected
the only problem I have is how do I manipulate the Appearance of a field
for example through cli if I want a field to be displayed as Url or radio it does not work
it always takes the default which is single line and also is there any method to set the help Text which
appears down in the appearance column

const contentful = require(‘contentful-management’)
const client = contentful.createClient({
accessToken: ‘XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX’
})
client.getSpace(‘XXXXXXXXXXXXXXXX’)
.then((space) => space.getEnvironment(‘XXXXXXXXXXXX’))
.then((environment) => environment.createContentTypeWithId(‘branding’,
{
name: “Branding”,
description: “Branding collects the header and footer elements for a given site.”,
displayField: “name”,
fields: [
{
id: “name”,
name: “Name”,
type: “Symbol”,
localized: false,
required: false,
validations: [],
disabled: false,
omitted: false
},
{
id: “header”,
name: “Header”,
type: “Link”,
localized: false,
required: true,
validations: [
{
linkContentType: [
“navigation”
]
}
],
disabled: false,
omitted: false,
linkType: “Entry”
},
{
id: “footer”,
name: “Footer”,
type: “Link”,
localized: false,
required: true,
validations: [
{
linkContentType: [
“navigation”
]
}
],
disabled: false,
omitted: false,
linkType: “Entry”
}
],
}))
.then((contentType) => console.log(contentType))
.catch(console.error)

does anyone know how to manipulate the appearance tab of a particular field through script

1 Like

Just wanted to hand you my two cents with the infamous ‘I have the same problem’

Hi, this is a naming inconsistency on our platform, the ‘appearance’ in the web app is ‘editor interface’ in the API.

Please find the JS code example to change it here: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface/editor-interface/update-the-editor-interface/console/js