Skip to main content

Admins

Retrieve the administrator accounts of your project and their attribute values.

More information about the module's user interface: https://doc.oneentry.cloud/docs/category/administrators (opens in a new tab)


The Admins module is read-only. It returns the administrator accounts of your OneEntry project and their attribute values, with optional filtering. You create accounts, assign roles and permissions (opens in a new tab) and revoke access in the OneEntry admin panel.

Quickstart​

Initialize the module from defineOneEntry:


const { } = defineOneEntry(
, {
}
);

Retrieve admins, optionally filtered by attribute conditions:

// Filter body: admins whose "num" attribute is greater than 1.
/** @type {import('oneentry').IFilterParams[]} */
const body = [
{ attributeMarker: "num", conditionMarker: "mth", conditionValue: 1 },
];

// getAdminsInfo(body, langCode, offset, limit): every argument is optional (defaults: [], the configured language, 0, 30).
const admins = await Admins.getAdminsInfo(body, "en_US", 0, 30);
if ('statusCode' in admins) throw new Error(admins.message);

admins.forEach((admin) => {
console.log(admin.id, admin.identifier);
});

Pass an empty array ([]) as the body when you don't need filtering.

Administrators​

An administrator is an account with elevated access that manages your OneEntry project. Each admin has an identifier (identifier), the attribute set it belongs to (attributeSetIdentifier) and the configured fields (attributeValues). Roles and permissions are configured in the admin panel and aren't returned by the SDK.

TypePurposeExample
AdministratorManages the system (backend)You, your team members
Regular UserUses your app/website (frontend)Your customers, website visitors

Admins manage content; Users consume it.

Key fields of an admin object:

{
id: 123, // Unique admin ID
attributeSetId: 27, // Attribute set ID
identifier: "admin", // Unique identifier
attributeSetIdentifier: "admins", // Attribute set identifier
position: 1, // Position
isSync: true, // Attribute values indexed for this language
attributeValues: {} // Attribute values
}

Filtering admins​

Filter with the request body: an array of conditions, each combining an attributeMarker, a conditionMarker and a conditionValue. The markers are the same as in the Products module. Conditions apply to indexed attributes of the admins' attribute set:

MarkerMeaningExample
eqEqualnum = 1
neqNot equalnum ≠ 1
inContains the value as a substring (case-insensitive)num in "1"
ninDoesn't contain the value as a substringnum nin "1"
mthMore thannum > 1
lthLess thannum < 3
exsExists (has value)num has a value
nexsDoes not existnum is empty
patMatches patterntitle matches "*man*"
sameHas any non-empty value (conditionValue is ignored)num has a value
same_partNot applied by the admins endpoint: conditionValue is ignoredno filtering

conditionValue is a single value (number | string | null), not an array.

Methods​

MethodDescription
getAdminsInfo()Get admin accounts, with optional filtering
getAdminsByVectorSearch()Search admins by meaning (vector search)

Parameters​


/** @type {import('oneentry').[]} */
const body = [
{
,
,
}
];

const response = await Admins.getAdminsInfo(body, "en_US", 0, 30);

Schema: (body)

attributeMarker: string
Marker of the attribute to filter by.
example: num

conditionMarker: string
Condition marker: 'in' - contains the value as a substring, 'nin' - does not contain the value as a substring, 'eq' - equal, 'neq' - not equal, 'mth' - more than, 'lth' - less than, 'exs' - exists, 'nexs' - does not exist, 'pat' - matches pattern, 'same' - has any non-empty value, 'same_part' - not applied by the admins endpoint
example: in
Enum: [ in, nin, eq, neq, mth, lth, exs, nexs, pat, same, same_part ]

conditionValue: number | string | null
A single value to compare against, not an array.
example: 1