Entity and Entities
const { Entity, Entities } = sdk.asAdmin().Customers()
Available on asAdmin() and asUser(). All calls resolve { status, result }.
Entity.get(humanId, fields?)
GET /api/v2/entity/{humanId}
| Parameter | Type | Description |
|---|---|---|
humanId | string | Required. Throws customers/missing-humanId if empty |
fields | string[] or { include?, exclude? } | Limit the returned fields. An array becomes ?fields=a,b, an object ?include=…&exclude=… |
await Entity.get('SC-ZW2VEG')
await Entity.get('SC-ZW2VEG', ['data.name', 'data.city'])
await Entity.get('SC-ZW2VEG', { exclude: ['data.bankHistory'] })
Errors: 400 entity/not-found. The entity type is not checked, the same call reads companies, people and groups.
Entities.list(params)
POST /api/v2/entities/list. Lists entities of one or more types.
| Parameter | Type | Description |
|---|---|---|
entityTypes | ('ou' | 'person' | 'group')[] | Required |
fields | string[] | Additional fields to return. Always included: entityType, id, humanId, data.title, data.name, data.firstName, data.lastName, data.legalType |
filterModel | object | { logicOperator: 'and' | 'or', items: [{ field, fieldType?, operator, value }] } |
hideInactive | boolean | Only data.active === true |
sort | array | Without pagination: ES clauses [{ 'data.name.keyword': 'asc' }]. With pagination: [{ field, sort: 'asc' | 'desc', fieldType? }] |
pagination | { page, pageSize = 100 } | Switches the response to { rows, totalCount }. Window limit 10,000 |
Response:
- without
pagination: an array of all matches. Each element is the source document plusscore; - with
pagination:{ rows, totalCount }.
Errors: 400 entity/missing-entity-type, 400 entity/pagination-window-exceeded.
Filter operators
| Type | Operators |
|---|---|
| string | contains, doesNotContain, startsWith, endsWith, equals, isEmpty, isNotEmpty |
| boolean | equals, isEmpty, isNotEmpty |
| virtual relation fields | includes (default), excludes |
Virtual fields: __GROUPS__, __MEMBERS__, __EMPLOYEES__, __EMPLOYMENTS__, __ROLES__.
Aliases: originalHumanId → humanId. contacts.<type> (email, phone, mobile, fax). data.bankHistory → data.bankHistory.iban.
Entities.search(params)
POST /api/v2/entities/search. Single-type search with free text.
| Parameter | Type | Description |
|---|---|---|
entityType | string | Required. Throws customers/missing-entity-type |
quickFilter | string | Free text against n-gram fields |
fields, filterModel, hideInactive, sort | As above | |
searchSubEntities | boolean | Also search sub-entities |
idsOnly | boolean | Return identifiers only |
Returns an array ordered by score. For OU results, the ancestors of the matches are appended without a score.
See the search guide for examples.