Assign constraints to an attribute
Configures the list of constraints for an attribute. The available constraints are: required, unique, locally-unique, alphabetic, alphanumeric, unicode-letters, unicode-printable, and email-address. See Attribute constraints for more information.
This is not an additive operation, you must pass in the entire set of constraints. The constraints included in your request replace any constraints already assigned to an attribute.
Removing constraints
Instead of removing a constraint, use this endpoint to overwrite the existing constraint with a new constraint. For example, suppose an attribute currently has the unique and required constraints, and you want to drop the required constraint. In that case, pass in constraints=["unique"]. Note that the constraints argument must be a valid JSON array. You can also pass an empty array, which removes all the constraints assigned to an attribute.
Refer to the Registration error codes page for details on error codes.
API client permissions
The following table indicates the API clients that can and can't be used to call this operation:
owner | acess_issuer | direct_access | direct_read_access | login_client |
---|---|---|---|---|
✓ | ✗ | ✗ | ✗ | ✗ |
Authentication
This operation supports both Basic authentication (recommended) and janrain-signed authentication. See Get started for more information.
Base URL
The base URL for this operation is your Identity Cloud Capture domain; for example:
https://educationcenter.us-dev.janraincapture.com
Your Capture domain (also known as a Registration domain) can be found in Console on the Manage Application page.
Examples
Example request: Ass gin a constraint to an attribute
This command assigns the required constraint to the givenName attribute in the user entity type. Among other things, this means that users must specify their given name when registering or when editing their user profile.
curl -X POST \
-H "Authorization: Basic c2dueXZ1czZwYzRqbTdraHIybmVxNWdzODlnYnIyZXE6d3Q0YzN1bjl3a2tjZnZ5a25xeDQ0eW5jNDc2YWZzNjg"\
--data-urlencode type_name=user \
--data-urlencode attribute_name=givenName \
--data-urlencode constraints=["required"] \
https://my-app.janraincapture.com/entityType.setAttributeConstraints
Example response
If your API call is successful the response consists of information about all the attributes in the schema:
{
"schema": {
"attr_defs": [
{
"name": "id",
"description": "simple identifier for this entity",
"type": "id"
},
{
"name": "uuid",
"description": "globally unique identifier for this entity",
"type": "uuid"
},
{
"name": "created",
"description": "when this entity was created",
"type": "dateTime"
},
{
"name": "lastUpdated",
"description": "when this entity was last updated",
"type": "dateTime"
},
{
"length": null,
"name": "aboutMe",
"type": "string",
"case-sensitive": false
},
{
"length": 1000,
"constraints": [
"required"
],
"name": "givenName",
"type": "string",
"case-sensitive": false
},
{
"name": "lastLogin",
"type": "dateTime"
}
],
"name": "user"
},
"stat": "ok"
}
Parameters
All parameters need to be configured as x-www-form-urlencoded body parameters.
Parameter | Type | Required | Description |
---|---|---|---|
type_name | string | ✓ | Name of the entity type containing the attribute you're modifying. |
attribute_name | string | ✓ | Case-sensitive name of the attribute. |
constraints | JSON array | ✓ | JSON-formatted set of constraints for the attribute. Allowed values are: • required • unique • locally-unique • alphabetic • alphanumeric • unicode-letters • unicode-printable • email-address. See Attribute constraints for more information. |
Updated over 1 year ago