Create Attribute

POST {{apiPath}}/environments/{{envID}}/schemas/{{schemaID}}/attributes

The following sample shows the POST /environments/{{envID}}/schemas/{{schemaID}}/attributes operation to add a new custom attribute to a specified schema resource. In the request body, the name property is required. All other properties are optional.

An attribute can support multiple values if the multiValued property is set to true. If the multiValued property is set to false or is null, the User object will contain the attribute value as a single value. If multiValued is set to true, the value in the User object will be an array. When searches are performed on User schema data, a user will match if any value of a multiValued attribute is part of the search criteria.

Note: The sample request shows an regexValidation property with its value returned by the request. It also shows an enumeratedValue property (for demonstration purposes) that is commented out because the service does not support both of these properties in the same POST request.

Prerequisites

See the Schema attributes POST, PUT, PATCH data model for full property descriptions.

PropertyTypeRequired?
descriptionStringOptional
displayNameStringOptional
enabledBooleanRequired
enumeratedValues\[\]ArrayOptional
enumeratedValues\[\].valueStringRequired
enumeratedValues\[\].archivedBooleanOptional
enumeratedValues\[\].descriptionStringOptional
ldapAttributeStringRequired
multiValuedBooleanOptional
nameStringRequired
regexValidationObjectOptional
regexValidation.patternStringRequired
regexValidation.requirementsStringRequired
regexValidation.valuesPatternShouldMatchArrayOptional
regexValidation.valuesPatternShouldNotMatchArrayOptional
requiredBooleanOptional
schema.idStringRequired
schemaTypeStringRequired
subAttributesArrayOptional
subAttributes.descriptionStringOptional
subAttributes.displayNameStringOptional
subAttributes.enabledBooleanRequired
subAttributes.nameStringRequired
subAttributes.requiredBooleanOptional
subAttributes.schemaTypeStringRequired
subAttributes.typeStringOptional
subAttributes.uniqueBooleanRequired
typeStringOptional
uniqueBooleanRequired

Request Body

{"name"=>"officeStuff{{$timestamp}}", "displayName"=>"An optional property that specifies the display name of the attribute.", "description"=>"An optional property that specifies the description of the new attribute.", "schemaType"=>"CUSTOM", "type"=>"STRING", "unique"=>false, "enabled"=>false, "multiValued"=>false, "regexValidation"=>{"pattern"=>"xs|XS|s|S|m|M|l|L|xl|XL|xxl|XXL", "requirements"=>"Must be a T-shirt size from XS to XXL", "valuesPatternShouldMatch"=>["xs", "XXL"], "valuesPatternShouldNotMatch"=>["xL", "x"]}, "#enumeratedValues"=>[{"value"=>"CUPS", "archived"=>true, "description"=>"Cups, Class: Clergy, Faculty: Emotions and love"}, {"value"=>"PENTACLES", "archived"=>true, "description"=>"Pentacles, Class: Merchants, Faculty: Material body or possessions"}, {"value"=>"SWORDS", "archived"=>true, "description"=>"Swords, Class: Nobility and military, Faculty: Reason"}, {"value"=>"WANDS", "archived"=>true, "description"=>"Wands, Class: Artisans, Faculty: Creativity and will"}]}

RESPONSES

status: Created

{"_links":{"self":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/schemas/dbaccb62-4fbb-4922-af88-70e2ea4ed5bf/attributes/8c36d189-2b42-443f-be44-e7cf888ae95c"},"environment":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"schema":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/schemas/dbaccb62-4fbb-4922-af88-70e2ea4ed5bf"}},"id":"8c36d189-2b42-443f-be44-e7cf888ae95c","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"name":"officeStuff1675293786","displayName":"An optional property that specifies the display name of the attribute.","description":"An optional property that specifies the description of the new attribute.","schemaType":"CUSTOM","type":"STRING","unique":false,"enabled":false,"multiValued":false,"required":false,"regexValidation":{"pattern":"xs|XS|s|S|m|M|l|L|xl|XL|xxl|XXL","requirements":"Must be a T-shirt size from XS to XXL","valuesPatternShouldMatch":["xs","XXL"],"valuesPatternShouldNotMatch":["xL","x"]},"schema":{"id":"dbaccb62-4fbb-4922-af88-70e2ea4ed5bf"}}