Create an Entity Type

Endpoint URL: {registrationDomain} /entityType.create



Description

Creates a new entity type (user profile data store) with the specified set of attributes. Note that each entity type you create will automatically include the following required attributes:

  • id
  • uuid
  • created
  • lastUpdated


Respects the API Client Allow List: Yes


API Client Permissions

The following table indicates the API clients that can (and the API clients that can't) be used to call this endpoint:

owner
access_issuer
direct_access
direct_read_access
login_client
Yes
No
No
No
No


Authentication

This endpoint supports both Basic authentication (recommended) and janrain-signed authentication.

How to Create an Authentication String


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 Registration domains) can be found in the Console on the Manage Application page:

Examples

Example Request

This command creates a new entity type named user_test. The new entity type contains two attributes:

  • name, a string attribute.
  • description, a non-case-sensitive string attribute with a maximum length of 1,000 characters.

curl -X POST \
  -H "Authorization: Basic c2dueXZ1czZwYzRqbTdraHIybmVxNWdzODlnYnIyZXE6d3Q0YzN1bjl3a2tjZnZ5a25xeDQ0eW5jNDc2YWZzNjg"\
  --data-urlencode type_name=user_test \
  --data-urlencode attr_defs='[{"name":"name","type":"string","case-sensitive":false},{"name":"description","type":"string","length":1000,"case-sensitive":false}]' \
    https://my-app.janraincapture.com/entityType.create
       

      Running this command in Postman

Example 1 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": 1000,
        "name": "description",
        "type": "string",
        "case-sensitive": false
      },
      {
        "length": null,
        "name": "name",
        "type": "string",
        "case-sensitive": false
      }
    ],
    "name": "user_test"
  },
  "stat": "ok"
}
       

The following command creates a new entity type named user2. This entity type includes the following attributes:

  • consent, a 200-character string value that is required and must be unique throughout the entity type
  • consentDescription, a 1,000-character string value
  • consentAttributes, a plural value containing a single child attribute (consentName

curl -X POST \
  -H "Authorization: Basic dXQ0YmdycmE3dzI4MmpjZm15cGZxeDlwemhxaGpqMmI6dW5qemU5bndrZnV5NmpwdzgzOHFwYTdhZDNoZG55YTY=" \
  --data-urlencode type_name=user2 \
  --data-urlencode attr_defs='[{"name":"consent","type":"string","length":200,"description": "The name of the consent in the user entity.","constraints":["unique", "required"]},{"name": "consentDescription","type":"string","length":1000,"description":"A short description of the consent."},{"name":"consentAttributes","type":"plural","description":"Attributes associated with the consent.","attr_defs":[{"name":"consentName","type": "string","length":200,"description":"An attribute name from the user entity.","features":["primary-key"],"constraints":["locally-unique", "required"]}]}]' \
    https://my-app.janraincapture.com/entityType.create
       

      Running this command in Postman

Example 2 Response


{
    "schema": {
        "name": "user2",
        "attr_defs": [{
            "name": "id",
            "type": "id",
            "description": "simple identifier for this entity"
        }, {
            "name": "uuid",
            "type": "uuid",
            "description": "globally unique identifier for this entity"
        }, {
            "name": "created",
            "type": "dateTime",
            "description": "when this entity was created"
        }, {
            "name": "lastUpdated",
            "type": "dateTime",
            "description": "when this entity was last updated"
        }, {
            "length": 200,
            "case-sensitive": true,
            "constraints": ["unique", "required"],
            "name": "consent",
            "type": "string",
            "description": "The name of the consent in the user entity."
        }, {
            "name": "consentAttributes",
            "attr_defs": [{
                "name": "id",
                "type": "id",
                "description": "simple identifier for this sub-entity"
            }, {
                "length": 200,
                "case-sensitive": true,
                "constraints": ["locally-unique", "required"],
                "name": "consentName",
                "features": ["primary-key"],
                "type": "string",
                "description": "An attribute name from the user entity."
            }],
            "type": "plural",
            "description": "Attributes associated with the consent."
        }, {
            "length": 1000,
            "case-sensitive": true,
            "name": "consentDescription",
            "type": "string",
            "description": "A short description of the consent."
        }]
    },
    "stat": "ok"
}
       


Query Parameters

ParameterTypeRequiredDescription
attr_defsstringYesInitial set of attributes (formatted as a JSON object) to be added to the entityType.

The JSON must be formatted similar to this:
[{"name":"Name","type":"string","case-sensitive":false}, {"name":"Description","type":"string","length":1000,"case-sensitive":false}].
type_namestringYesName of the entityType.