Person
Guide: People.
const { Person } = sdk.asAdmin().Customers()
Person.create(body, options?)
POST /api/v2/entity/person
| Body | Type | Description |
|---|---|---|
data | object | Required. Validated against the full Person schema by default (same fields as update, below); firstName and lastName are the only required ones |
groups | string[] | Group names |
employments | [{ humanId, roles }] | humanId is the company |
Options { return: true }. { schema: 'minimal' } validates against just firstName, lastName and title instead. { strict: true } rejects any field in data not in the schema being validated against.
Person.update(humanId, body)
PUT /api/v2/entity/person/{humanId}. Body: data (merged by default), overwrite (replace entirely instead of merging), strict (reject unknown fields in data), groups, employments (replace), return.
Updatable fields: active, avatar, salutation, title, firstName, lastName, birthName, birthDate, birthPlace, contacts, website, hasAddress, extra, street, houseNo, zipCode, city, countryCode, location, hasBank, bankHistory.
Person.delete(humanId)
DELETE /api/v2/entity/person/{humanId}. Status 200, { result: 'deleted', humanId }.
Person.upsertEmployment(personId, ouId, roles, options?)
POST /api/v2/entity/person/{person}/employments/{ou} with { data: { roles }, return? }.
Person.removeEmployment(personId, ouId)
DELETE /api/v2/entity/person/{person}/employments/{ou}. Status 200, { result: 'deleted', humanId }.
Data reference
| Field | Type / values |
|---|---|
salutation | formal-neutral, personal-neutral, formal-female, formal-male |
birthDate | YYYY-MM-DD |
contacts[] | { id?, contactType: 'email' | 'phone' | 'mobile' | 'fax', value, isFavorite } |
contacts[].value | email: { email }. Phone: { phone: { countryCode, dialingCode, number } } |
hasAddress | boolean, true before setting address fields |
countryCode | ISO code such as DE. Required when hasAddress |
bankHistory[] | { bankAccountOwner, iban, bankNote, bankValidFrom, bankValidTill, inherited, inheritedFrom } |