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.
| Type | Purpose | Example |
|---|---|---|
| Administrator | Manages the system (backend) | You, your team members |
| Regular User | Uses 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:
| Marker | Meaning | Example |
|---|---|---|
| eq | Equal | num = 1 |
| neq | Not equal | num ≠ 1 |
| in | Contains the value as a substring (case-insensitive) | num in "1" |
| nin | Doesn't contain the value as a substring | num nin "1" |
| mth | More than | num > 1 |
| lth | Less than | num < 3 |
| exs | Exists (has value) | num has a value |
| nexs | Does not exist | num is empty |
| pat | Matches pattern | title matches "*man*" |
| same | Has any non-empty value (conditionValue is ignored) | num has a value |
| same_part | Not applied by the admins endpoint: conditionValue is ignored | no filtering |
conditionValue is a single value (number | string | null), not an array.
Methods
| Method | Description |
|---|---|
| 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
Related
- Users Module: frontend user accounts
- AttributesSets Module: attribute sets behind admin fields
- OneEntry Admin Panel - Administrators: admin panel documentation