Step 2: Retrieve Custom Fields in an Account
Retrieve All Custom Fields from an Account
If you are currently using the Custom Fields: List
endpoint, the Configuration equivalent is a combination of Resource Names: List
and Resource Configuration: Get
.
Whereas Custom Fields: List
would list all custom fields and all properties of those fields (i.e. Field type, group, description), the Configuration API split this up into two calls. Resource Names: List
will return a list of all custom field IDs in the account. From there Resource Configuration: Get takes a custom field ID as an input to return all properties of the requested field.
Notable Callouts
- The
id
field is now called$id
- The
customFieldId
in the Custom Fields API Documentation is referenced as theresourceId
in the Configuration API This is because many things can be resources (custom fields, custom entities, etc.)
Custom Fields API
Custom Fields: List
{
"meta": {
"uuid": "0186dda8-7cf2-064b-ed3e-26ce21b50133",
"errors": []
},
"response": {
"count": 8,
"customFields": [
{
"id": "c_linkedHelpArticles",
"type": "ENTITY_RELATIONSHIP",
"name": {
"value": "Linked Help Articles",
"translations": []
},
"alternateLanguageBehavior": "PRIMARY_ONLY",
"group": "NONE",
"validation": {
"minItemCount": 0,
"maxItemCount": 5000,
"entityRelationship": {
"supportedDestinationEntityTypeIds": [],
"type": "ONE_WAY"
}
},
"entityAvailability": [
"location"
]
},
{
"id": "c_myNewField",
"type": "TEXT",
"name": {
"value": "My New Field",
"translations": []
},
"alternateLanguageBehavior": "PRIMARY_ONLY",
"group": "NONE",
"validation": {
"minCharLength": 0
},
"description": {
"value": "",
"translations": []
},
"entityAvailability": []
},...
]
}
}
Resource Configuration API
Resource Names: List
{
"meta": {
"uuid": "0186ddb0-de68-1503-5579-da57125cd33b",
"errors": []
},
"response": [
"c_countryFullName",
"c_linkedHelpArticles",
"c_myNewField",
"c_richTextBox",
"c_specialMarkdownField",
"c_storeUsername",
"c_validatingLengthCoolText",
"c_woahSuperCoolText"
]
}
Resource Configuration: Get
{
"meta": {
"uuid": "0186ddc7-37c9-f839-2f48-81164956456a",
"errors": []
},
"response": {
"$id": "c_linkedHelpArticles",
"$schema": "https://schema.yext.com/config/km/field/v1",
"displayName": "Linked Help Articles",
"group": "NONE",
"localization": "PRIMARY_ONLY",
"type": {
"listType": {
"typeId": "entityReference",
"maxLength": 5000,
"type": {
"entityReferenceType": {
"type": "ONE_WAY"
}
}
}
},
"typeId": "list"
}
}
Retrieve a Single Custom Field in an Account
If you are currently using the Custom Fields: Get endpoint
, the Configuration equivalent is Resource Configuration: Get
Custom Fields API
Custom Fields: Get
{
"meta": {
"uuid": "0186e076-4529-6745-c359-32a50d956112",
"errors": []
},
"response": {
"id": "c_linkedHelpArticles",
"type": "ENTITY_RELATIONSHIP",
"name": {
"value": "Linked Help Articles",
"translations": []
},
"alternateLanguageBehavior": "PRIMARY_ONLY",
"group": "NONE",
"validation": {
"minItemCount": 0,
"maxItemCount": 5000,
"entityRelationship": {
"supportedDestinationEntityTypeIds": [],
"type": "ONE_WAY"
}
},
"entityAvailability": [
"location"
]
}
}
Resource Configuration API
Resource Configuration: Get
{
"meta": {
"uuid": "0186ddc7-37c9-f839-2f48-81164956456a",
"errors": []
},
"response": {
"$id": "c_linkedHelpArticles",
"$schema": "https://schema.yext.com/config/km/field/v1",
"displayName": "Linked Help Articles",
"group": "NONE",
"localization": "PRIMARY_ONLY",
"type": {
"listType": {
"typeId": "entityReference",
"maxLength": 5000,
"type": {
"entityReferenceType": {
"type": "ONE_WAY"
}
}
}
},
"typeId": "list"
}
}
Feedback
<% elem.innerText %>