/entityType.addAttribute

Adds an attribute to an existing entityType schema and all stored objects of that type.

Note. Each attribute requires a type which defines the nature of the data to be stored.

Refer to the Registration Error Codes section for details on error codes. Use this link for a video demo in Postman.

This endpoint supports 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 Requests

1) Add a 50 character string key named "fullName" to an existing entityType "user". In this case, the attribute is added to a simple custom schema built with the "name", "type", and "length" attributes.


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

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 1 Response


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

2) To create an object you need to use a very specific JSON format which includes a nested attr_defs within the attr_def value:


curl -X POST \
    -H "Authorization: Basic aW1fYV...NfbXk="\
    --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
          

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 2 Response


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

3) To create an plural you also need to use a very specific JSON format which includes a nested attr_defs within the attr_def value:


curl -X POST \
    -H "Authorization: Basic aW1fYV...NfbXk="\
    --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
          

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 3 Response


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

Add a new dateTime attribute.


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

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 4 Response


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

Authorized Clients

  • owner

Security

  •  janrain-signed
  •  basic-auth

Query Parameters

Parameter Type Required Description
type_name string Yes Name of the entityType.
 
attr_def string Yes Attribute (formatted as a JSON object) to be added to the entityType. For example:

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