Step 3: Create a New Custom Field
Creating a new Custom Field via the Custom Fields: Create endpoint is now performed via Resource Configuration: Create.
Notable Callouts
In addition to the base endpoint changing, some notable differences between the API calls are:
- Custom Fields API requires the
nameandtypebe specified. Configuration API requires the$id,$schema,displayName,typeId,localization,groupbe specifiedtypeis also required if you are creating a booleanType, dateType, decimalType, imageType, listType, optionType, richTextType, stringType, structType, or videoType.
- The response is now a JSON object, not an array.
localizationis now required to be specified explicitly. In the Custom FIelds API, it defaults to “PRIMARY_ONLY”.groupis now required to specified explicitly - in the Custom FIelds API, it defaults to “NONE”.
Custom Fields API
Custom Fields: Create
[
{
"name":{
"value":"My New Boolean Field",
"translations":[]
},
"group":"NONE",
"type":"BOOLEAN"
}
]Resource Configuration API
Resource Configuration: Create
{
"$id":"c_myNewBooleanField",
"$schema":"https://schema.yext.com/config/km/field/v1",
"displayName":"My New Boolean Field",
"group":"NONE",
"localization":"PRIMARY_ONLY",
"type":{
"booleanType":{}
},
"typeId":"boolean"
}
<% elem.innerText %>