Create an attribute

Create an attribute
Open Recipe
Add a plural attribute to an entity type
Open Recipe
Add an object attribute to an entity type
Open Recipe

Adds an attribute to an entity type; doing this also adds the new attribute to all existing user profiles.

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:

owneraccess_issuerdirect_accessdirect_read_accesslogin_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 endpoint is your Identity Cloud Capture domain; for example:

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

Your Capture domains (also known as a Registration domain) can be found in Console on the Manage Application page.

Examples

Example 1: Add a string attribute to an entity type

This command adds a 50-character string attribute (fullName) to the user entity type:

curl -X POST \
  -H "Authorization: Basic c2dueXZ1czZwYzRqbTdraHIybmVxNWdzODlnYnIyZXE6d3Q0YzN1bjl3a2tjZnZ5a25xeDQ0eW5jNDc2YWZzNjg"\
  --data-urlencode type_name=user \
  --data-urlencode attr_def='{"name":"fullName","type":"string","length":50}' \
  https://my-app.janraincapture.com/entityType.addAttribute

Example 1 response

If your API call succeeds, the response consists of information about all the attributes in the schema:

{
  "schema": {
    "attr_def": [
      {
        "description": "simple identifier for this entity",
        "name": "id",
        "type": "id"
      },
      {
        "description": "globally unique identifier for this entity",
        "name": "uuid",
        "type": "uuid"
      },
      {
        "description": "when this entity was created",
        "name": "created",
        "type": "dateTime"
      },
      {
        "description": "when this entity was last updated",
        "name": "lastUpdated",
        "type": "dateTime"
      },
      {
        "case-sensitive": false,
        "length": 1000,
        "name": "Description",
        "type": "string"
      },
      {
        "case-sensitive": false,
        "length": null,
        "name": "Name",
        "type": "string"
      },
      {
        "case-sensitive": true,
        "length": 50,
        "name": "fullName",
        "type": "string"
      }
    ],
    "name": "user"
  },
  "stat": "ok"
}

Example 2: Add an object attribute to an entity type

The following command adds a new object attribute (testObject) to the user entity type. The new object contains two child attributes (testOne and testTwo), both 256-character string attributes.

curl -X POST \
  -H "Authorization: Basic c2dueXZ1czZwYzRqbTdraHIybmVxNWdzODlnYnIyZXE6d3Q0YzN1bjl3a2tjZnZ5a25xeDQ0eW5jNDc2YWZzNjg" \
  --data-urlencode type_name=user \
  --data-urlencode attr_def='{"name":"testObject","type":"object","attr_defs":[{"name":"testOne","type":"string","length":256},{"name":"testTwo","type":"string","length": 256}]}' \
  https://my-app.janraincapture.com/entityType.addAttribute

📘

Object and plural attributes can be nested within another object or plural. Attribute nesting is limited to a depth of 5 attributes. For example:

  • object1.plural2.object3.plural4.givenName
    (This is a depth of 5 attributes and is allowed.)
  • object1.plural2.object3.plural4.object5.givenName
    (This is a depth of 6 attributes and is NOT allowed.)

Example 2 response

If your API call succeeds, the response consists of information about all the attributes in the schema:

{
  "schema": {
    "attr_def": [
      {
        "description": "simple identifier for this entity",
        "name": "id",
        "type": "id"
      },
      {
        "description": "globally unique identifier for this entity",
        "name": "uuid",
        "type": "uuid"
      },
      {
        "description": "when this entity was created",
        "name": "created",
        "type": "dateTime"
      },
      {
        "description": "when this entity was last updated",
        "name": "lastUpdated",
        "type": "dateTime"
      },
      {
        "case-sensitive": false,
        "length": 1000,
        "name": "Description",
        "type": "string"
      },
      {
        "case-sensitive": false,
        "length": null,
        "name": "Name",
        "type": "string"
      },
      {
        "attr_defs":[
        {
          "length":256,
          "name":"testOne",
          "type":"string",
          "case-sensitive":true
        },
        {
          "length":256,
          "name":"testTwo",
          "type":"string",
          "case-sensitive":true
        }
        ],
        "name":"testObject",
        "type":"object"
      }
      ],
    "name": "user"
  },
  "stat": "ok"
}

Example 3: Add a plural attribute to an entity type

The following command adds a new plural attribute (testPlural) to the user entity type. The new plural contains two child attributes (testPOne and testPTwo), both 256-character string attributes.

curl -X POST \
    -H "Authorization: Basic dXQ0YmdycmE3dzI4MmpjZm15cGZxeDlwemhxaGpqMmI6dW5qemU5bndrZnV5NmpwdzgzOHFwYTdhZDNoZG55YTY"\
    --data-urlencode type_name=user \
    --data-urlencode attr_def='{"name":"testPlural","type":"plural","attr_defs":[{"name":"testPOne","type":"string","length":256},{"name":"testPTwo","type":"string","length": 256}]}'\
    https://my-app.janraincapture.com/entityType.addAttribute

📘

Object and plural attributes can be nested within another object or plural. Attribute nesting is limited to a depth of 5 attributes. For example:

  • object1.plural2.object3.plural4.givenName
    (This is a depth of 5 attributes and is allowed.)
  • object1.plural2.object3.plural4.object5.givenName
    (This is a depth of 6 attributes and is NOT allowed.)

Example 3 response

If your API call succeeds, the response consists of information about all the attributes in the schema:

{
  "schema": {
    "attr_def": [
      {
        "description": "simple identifier for this entity",
        "name": "id",
        "type": "id"
      },
      {
        "description": "globally unique identifier for this entity",
        "name": "uuid",
        "type": "uuid"
      },
      {
        "description": "when this entity was created",
        "name": "created",
        "type": "dateTime"
      },
      {
        "description": "when this entity was last updated",
        "name": "lastUpdated",
        "type": "dateTime"
      },
      {
        "case-sensitive": false,
        "length": 1000,
        "name": "Description",
        "type": "string"
      },
      {
        "case-sensitive": false,
        "length": null,
        "name": "Name",
        "type": "string"
      },
      {
        "attr_defs":[
        {
          "length":256,
          "name":"testPOne",
          "type":"string",
          "case-sensitive":true
        },
        {
          "length":256,
          "name":"testPTwo",
          "type":"string",
          "case-sensitive":true
        }
        ],
        "name":"testPlural",
        "type":"plural"
      }
      ],
    "name": "user"
  },
  "stat": "ok"
}

Example 4: Add a dateTime attribute to an entity type

The following command adds a new dateTime attribute (emailPreVerified) to the user entity type:

curl -X POST \
    -H "Authorization: Basic dXQ0YmdycmE3dzI4MmpjZm15cGZxeDlwemhxaGpqMmI6dW5qemU5bndrZnV5NmpwdzgzOHFwYTdhZDNoZG55YTY"\
    --data-urlencode type_name=user \
    --data-urlencodeattr_def='{"name":"emailPreVerified","type":"dateTime"}' \
    https://my-app.janraincapture.com/entityType.addAttribute

Example 4 response

If your API call succeeds, the response consists of information about all the attributes in the schema:

{
  "schema": {
    "attr_def": [
      {
        "description": "simple identifier for this entity",
        "name": "id",
        "type": "id"
      },
      {
        "description": "globally unique identifier for this entity",
        "name": "uuid",
        "type": "uuid"
      },
      {
        "description": "when this entity was created",
        "name": "created",
        "type": "dateTime"
      },
      {
        "description": "when this entity was last updated",
        "name": "lastUpdated",
        "type": "dateTime"
      },
      {
        "case-sensitive": false,
        "length": 1000,
        "name": "Description",
        "type": "string"
      },
      {
        "case-sensitive": false,
        "length": null,
        "name": "Name",
        "type": "string"
      },
      {
        "name":"emailPreVerified",
        "type":"dateTime"
      }
      ],
    "name": "user"
  },
  "stat": "ok"
}

Parameters

All parameters need to be configured as x-www-form-urlencoded body parameters.

ParameterTypeRequiredDescription
type_namestringName of the entity type you're assigning the attribute to.
attr_defJSON objectProperties and property values for th attribute you're adding to the entity type. For example:

{"name":"fullName","type":"string","length":50}

See Schema data types for more information.