/entityType.setAttributeConstraints

Set the list of constraints for an attribute.

Warning. This is not an additive operation, you must pass in the entire set of constraints.

The available constraints are required, unique, locally-unique, alphabetic, alphanumeric, unicode-letters, unicode-printable, and email-address.

Note. See the Data Constraints and Features topic for more information.

Removing Constraints

Instead of removing a constraint, use this call to overwrite the existing constraint with a new constraint. If an attribute currently has the unique and requiredconstraints, and you want to drop the required constraint, then you would pass in constraints=["unique"]. The constraints argument must be a valid JSON array, however you can pass in an empty array, which is the equivalent of no constraints at all.

Refer to the Registration Error Codes section for details on error codes.

This command includes the following methods:

  • POST


POST

Base URL

The base URL for this endpoint is your Janrain Capture domain; for example:

https://educationcenter.us-dev.janraincapture.com

Your Capture domains (also known as Registration domains) can be found in the Janrain Console on the Manage Application page:

Examples

Example Request

Set a "required" constraint on an attribute called "Name" on the 'user' entity.


curl -X POST \
    -H "Authorization: Basic aW1fYV...NfbXk="\
    --data-urlencode type_name=user \
    --data-urlencode attribute_name=givenName \
    --data-urlencode constraints=["required"] \
    https://my-app.janraincapture.com/entityType.setAttributeConstraints
          

Running Code Samples Using Postman

The Janrain REST API code samples are written using Curl, but they can easily be run from within Postman. To use one of our code samples in Postman:

  1. Click the Copy to Clipboard button located directly beneath the code sample
  2. In Postman, click Import to display the Import dialog box.
  3. In the Import dialog box, click Paste Raw Text, and then paste in the copied code. The Import dialog box should look similar to this:

  4. Click Import, and the Curl command will be converted to a format that can be run from within Postman. All you need to do now is configure the command to work with your Janrain implementation.

Example Response


{
  "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"
}
          

Authorized Clients

owner

Security

  •  janrain-signed
  •  basic-auth

Query Parameters

Parameter Type Required Description
type_name string Yes Name of the entityType.
 
attribute_name string Yes Case-sensitive name of the attribute to be modified.
 
constraints string Yes JSON-formatted list of constraints for the attribute.