Skip to main content

Overview

A Custom Object is a schema-less, flexible data structure that can be linked to a specific account. It dynamically adapts, allowing additional fields or data formats to be added as needed.

Custom Objects allow you to analyze and retrieve insights into how data is stored within your LoginRadius Cloud Directory. They provide a flexible, schema-less structure, enabling dynamic data storage and customization based on your needs.

Note: To use Custom Object APIs, contact LoginRadius Support to have custom objects added to your account and the data indexed according to your requirements.

Running Custom Objects API

You need to be informed of the following information to run the Custom Objects API.

The following is the base URL for all API requests:

https://cloud-api.loginradius.com/customobject

Supported Types and Corresponding Operators/Values

The following are the different types of operators based on the type and corresponding values they can have

Supported Operators: >, >=, <, <=, BETWEEN, =, !=
Description: These operators are used for fields with integer or date types.
Example:

  • Age > 18
  • DateCreated BETWEEN '2022-01-01' AND '2022-12-31'

Sample and Formats

Please refer to the Format of Custom Objects and Schema of the Custom Objects for reference.

Here is a sample format of Custom Objects:

{
"IsActive": true,
"DateCreated": "2018-01-31T09:02:40.290Z",
"DateModified": "2018-01-31T09:02:40.290Z",
"IsDeleted": false,
"Uid": 123456,
"CustomObject": <Actual Custom Object>
}

Internal fields include:

  • IsActive (boolean)
  • DateModified (date)
  • DateCreated (date)
  • IsDeleted (boolean)
  • Uid (string)

CustomObject keys and their types are retrieved from the Schema Definition.

Querying Basic Fields

Here are a few examples of querying basic fields:

Query for searching Custom Objects where the “State” field of Custom Object has a value of “British Columbia”

"rule": {
"name": "CustomObject.State",
"operator": "=",
"value": "British Columbia"
}

Query for searching Custom Objects where the “Price” field of Custom Object is between “200” and “500”

"rule": {
"name": "CustomObject.Price",
"operator": "BETWEEN",
"value": [200, 500]
}

Note for Array of Strings/Integers: Querying a field that contains an array of strings will return the document if the array includes the specified value. For example, if a document has a "Roles" field with values ['Admin', 'Developer', 'QA'], a query for Roles = Admin or Roles = Developer will return the document. However, a query for Roles = Business will not return it.

Note for Range Fields: For the BETWEEN operator, the value should be an array. The first value will be used as FROM and the second as TO. The values are inclusive. Example "value": [20, 50] translates to value being in between 20 & 50(inclusive). The range is inclusive.

Querying Objects

You can use dot notation to query nested fields within objects.

Example: Object Structure

"CustomObject": {
"key1": ...,
"key2": ...,
"key3": ...,
"key4": ...,
"key5": {
"Code": "Dr",
"Name": "Doctor"
}
}

Example Query

To filter records where CustomObject.key5.Code is "Dr", use the following rule:

"rule": {
"name": "CustomObject.key5.Code",
"operator": "=",
"value": "Dr"
}

This query will return all records where the Code field inside key5 has the value "Dr".

Querying an Array of Objects

You can use dot notation to query fields within an array of objects. The query will return results where at least one object in the array meets the specified condition.

Example: Array of Objects Structure

"CustomObject": {
"key1": ...,
"key2": ...,
"key3": ...,
"key4": [
{
"Type": "Primary",
"Value": "youtube"
},
{
"Type": "Secondary",
"Value": "vimeo"
}
],
"key5": ...
}

Example Queries

Querying for specific values in CustomObject.key4:

{
"name": "CustomObject.key4.Value",
"operator": "=",
"value": "vimeo"
}
{
"name": "CustomObject.key4.Type",
"operator": "=",
"value": "Primary"
}

These queries will return records where:

  • At least one object in key4 has Value = "vimeo".

  • At least one object in key4 has Type = "Primary".

Note: Ensure the sub-field type is correct before querying.

Combining Rules into a Group

A group can contain one or more rules and sub-groups. Each group requires an operator (AND or OR) and an array of rules or sub-groups.

Group Structure

"group": {
"operator": "AND",
"rules": [<rule>, <rule>, <sub-group>]
}

Example: Complex Query Group

"group": {
"operator": "AND",
"rules": [
{
"name": "IsActive",
"operator": "=",
"value": true
},
{
"name": "DateCreated",
"operator": ">",
"value": "2017-01-01"
},
{
"group": {
"operator": "OR",
"rules": [
{
"name": "CustomObject.key1",
"operator": "=",
"value": "value1"
},
{
"name": "CustomObject.key2",
"operator": "=",
"value": "value2"
}
]
}
}
]
}

Example Query: Filtering Custom Objects

Retrieve all Custom Objects created between 2017-01-01 and 2017-12-31 while ensuring:

  • IsActive is true

  • DateCreated is after 2017-01-01

  • Either CustomObject.key1 = "value1" OR CustomObject.key2 = "value2"

Query Representation:

(IsActive = true) AND (DateCreated > 2017-01-01) AND (CustomObject.key1 = value1 OR CustomObject.key2 = value2)

API Query Example

{
"from": "2017-01-01",
"to": "2017-12-31",
"q": {
"group": {
"operator": "AND",
"rules": [
{
"name": "IsActive",
"operator": "=",
"value": true
},
{
"name": "DateCreated",
"operator": ">",
"value": "2017-01-01"
},
{
"group": {
"operator": "OR",
"rules": [
{
"name": "CustomObject.key1",
"operator": "=",
"value": "value1"
},
{
"name": "CustomObject.key2",
"operator": "=",
"value": "value2"
}
]
}
}
]
}
}
}

Note: If the object structure changes (e.g., a new field is added), you can still use the Data Query Tool to search based on the updated field. However, you must update the schema before querying the new field.

To reindex data with the updated schema, please contact the LoginRadius Support Team.

Custom Objects with Identity APIs

The Custom Object with Identity API retrieves a customer's identity information and associated Custom Object data in a single API call.

Note: Before leveraging these APIs, contact LoginRadius Support to ensure you have set the schema for the Custom Object and indexed it. You can review the set schema for your Custom Object in our Admin Console.

We are providing the following APIs in this section:

Following is the Base URL for all API requests:

https://cloud-api.loginradius.com/identity/customobject