Skip to main content

Overview

The LoginRadius Cloud Directory offers a powerful, centralized platform for managing and retrieving user identity data. It is designed to support scalable identity management through two key APIs:

Organizations can leverage the Cloud Directory to analyze how user data is stored and managed, ensuring seamless identity recognition across their digital ecosystem.

Running Cloud Directory API

You need to be informed of the following information to run the cloud Directory API.

The following is the Base URL for all API requests:

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

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, =, !=
Supported Values: It should be an integer as per the integer type.
Example: 1, 10, -1, 0
There should be a valid date for the date type.
Example: 2017-01-01

Supported Keys and their Types

Refer to the Detailed Data Points table for a comprehensive list of LoginRadius profile fields, subfields, and their data types. This information ensures you select the appropriate operator when querying Cloud Directory APIs.

Querying Basic Fields

Here are a few examples of querying basic fields:

Query for searching user databases where the age is greater than 20

{
"name": "Age",
"operator": ">",
"value": 20
}

Query for searching user databases where the age is between 20 & 50(Inclusive)

{
"name": "Age",
"operator": "BETWEEN",
"value": [20, 50]
}

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 value will be used as TO. The values are inclusive. Example "value": [20, 50] translates to value being in between of 20 & 50(inclusive). The range is inclusive.

Querying NULL Values

To check for non-null values in a field, use the EXISTS operator:

{
"name": "Gender",
"operator": "EXISTS"
}

This rule returns documents where the Gender field has a non-null value.

Examples of non-null values:

{ "Gender": "," }
{ "Gender": "Male" }
{ "Gender": "" } // An empty string is considered non-null
{ "Gender": ["Male"] }
{ "Gender": ["Male", null] }

To check for null values, use the NOT_EXISTS operator:

{
"name": "Gender",
"operator": "NOT_EXISTS"
}

This rule returns documents where the Gender field is null or does not exist.

Examples of null values:

{ "Gender": null }
{ "Gender": [] }
{ "Gender": [null] }
{ "Gender1": "bar" } // The Gender field is missing

Querying Text

When searching text fields, values are analyzed using individual terms. Consider the following dataset with FirstName values:

CaseFirstNameAnalyzed Terms
1i am identity apii, am, identity, api
2i AM insights APIi, am, insights, api
3i am@insights api'si, am, insights, api's
4i-am-customobject-apii, am, customobject, api
5i-customobject-am-apii, am, customobject, api

Matching Rules
Matches all (1, 2, 3, 4, 5):

{
"name": "FirstName",
"operator": "Contains",
"value": "am"
}
{
"name": "FirstName",
"operator": "Contains",
"value": "AM"
}

Matches (1, 2, 4, 5):

{
"name": "FirstName",
"operator": "Contains",
"value": "api"
}
{
"name": "FirstName",
"operator": "Contains",
"value": "API"
}

Matches only (3):

{
"name": "FirstName",
"operator": "Contains",
"value": "API's"
}

Matches all (1, 2, 3, 4, 5):

{
"name": "FirstName",
"operator": "Contains",
"value": "am-customobject"
}

Here, "am-customobject" is split into "am" and "customobject", and since "am" exists in all entries, all five documents are returned.

Filtering Specific Results
To retrieve only case 3 & 4, combine multiple rules using AND:

"group": {
"operator": "AND",
"rules": [
{
"name": "FirstName",
"operator": "=",
"value": "am"
},
{
"name": "FirstName",
"operator": "=",
"value": "customobject"
}
]
}

This ensures that only documents containing both terms are matched.

Querying Dates

Date fields can be queried by passing a valid ISO8601 date value
Special Case: BirthDate supports MM-DD-YYYY format as well.

Searching user databases where the birthdate is 19th March 2019

{
"name" : "BirthDate",
"operator" : "=",
"value" : "03-19-2019"
}

Searching user databases where the profiles are created after 05th March 2001

{
"name" : "CreatedDate",
"operator" : ">",
"value" : "2001-03-05T18:30:00Z"
}

Querying Objects

You can access object fields using dot notation. Here's an example of an object field:

"SignupLog": {
"UserAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0.",
"Host": "example.com",
"IP": "123.13.123.123"
}

To query nested fields, use dot notation:

Example Query:

{
"name": "SignupLog.Host",
"operator": "=",
"value": "example.com"
}

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

Querying an Array of Objects

You can use dot notation to query fields within an array of objects. The query will match if at least one object in the array satisfies the condition.

Example: Email Array in the user profile

"Email": [
{
"Type": "Primary",
"Value": "[email protected]"
},
{
"Type": "Secondary",
"Value": "[email protected]"
}
]

Query to match an email:

{
"name": "Email.Value",
"operator": "=",
"value": "[email protected]"
}

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

Example: Querying Positions

If a Position field is stored as text or a string, it supports both "=" and "Contains" operators:

{
"name": "Positions.Position",
"operator": "=",
"value": "Developer"
}
{
"name": "Positions.Position",
"operator": "Contains",
"value": "Developer"
}

Combining Rules into a Group

A group can contain one or more rules and sub-groups, each with an AND or OR operator applied.

Group Structure:

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

Example: Nested Group Query

The following query retrieves users who:

  • Have EmailVerified = true
  • Have a Provider of either Google or Facebook
"group": {
"operator": "AND",
"rules": [
{
"name": "EmailVerified",
"operator": "=",
"value": true
},
{
"group": {
"operator": "OR",
"rules": [
{
"name": "Provider",
"operator": "=",
"value": "Google"
},
{
"name": "Provider",
"operator": "=",
"value": "Facebook"
}
]
}
}
]
}

Example: Filtering Users by Date Range

Retrieve all users created between 2016-01-01 and 2016-12-31, ensuring from and to values are specified:

{
"from": "2016-01-01",
"to": "2016-12-31",
"q": {
"group": {
"operator": "AND",
"rules": [
{
"name": "EmailVerified",
"operator": "=",
"value": true
},
{
"group": {
"operator": "OR",
"rules": [
{
"name": "Provider",
"operator": "=",
"value": "Google"
},
{
"name": "Provider",
"operator": "=",
"value": "Facebook"
}
]
}
}
]
}
}
}

Use Case 1: Fetch Email Profiles Without a Registration Source

Retrieve email-based profiles that do not contain a RegistrationSource field:

{
"group": {
"operator": "AND",
"rules": [
{
"name": "RegistrationSource",
"operator": "NOT_EXISTS",
"value": null
},
{
"name": "Provider",
"operator": "=",
"value": "Email"
}
]
}
}

Result: Only email profiles that do not have a RegistrationSource are returned.

Use Case 2: Fetch Recently Updated Profiles

Retrieve profiles where the ModifiedDate is later than 2021-08-09T18:47:26Z:

{
"group": {
"operator": "AND",
"rules": [
{
"name": "Provider",
"operator": "=",
"value": "Email"
},
{
"name": "ModifiedDate",
"operator": ">",
"value": "2021-08-09T18:47:26Z"
}
]
}
}

Result: Returns profiles filtered based on the last modified date.