Create an entity type
Creates a new entity type (user profile data store) using the specified set of attributes.
Refer to the Registration error codes page for details on error codes.
Description
Creates a new entity type schema. Note that each entity type you create automatically includes these required attributes:
- id
- uuid
- created
- lastUpdated
API client permissions
The following table indicates the API clients that can and can't be used to call this operation:
owner | access_issuer | direct_access | direct_access_read | 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 1: Create an entity type with two string attributes
This command creates a new entity type named user_test. The new entity type contains two attributes:
- name, a string attribute.
- description, a case-insensitive 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
Example 1 response
If your API call succeeds, the response contains information about all the attributes in the entity type, including the four attributes automatically added to each 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": 1000,
"name": "description",
"type": "string",
"case-sensitive": false
},
{
"length": null,
"name": "name",
"type": "string",
"case-sensitive": false
}
],
"name": "user_test"
},
"stat": "ok"
}
Example 2: Create an entity type that includes a plural attribute
The following command creates a new entity type named user2. This entity type includes the following attributes:
- consent, a 200-character string value that's 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
Example 2 response
If your API call succeeds, the response contains information about all the attributes in the entity type, including the four attributes automatically added to each schema:
{
"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"
}
Parameters
All parameters need to be configured as x-www-form-urlencoded body parameters.
Parameter | Type | ||
---|---|---|---|
attr_defs | JSON object | ✓ | Initial set of attributes for the entity type. The JSON for the attr_defs parameter needs to be formatted similar to this: [{"name":"Name","type":"string","case-sensitive":false}, {"name":"Description","type":"string","length":1000,"case-sensitive":false}] See Schema data types for more information. |
type_name | string | ✓ | Name of the new entity type. |
Updated over 1 year ago