metadata.find()

Retrieves the Metadata for an existing Group or User entity.

Definition

client.metadata.find(
entityId: string|Group|User,
organizationId: string,
options: ?Object
):Promise<Metadata,Error>

Parameters

ParameterTypeDescription
entityIdstring|Group|UserThe entity that the metadata is associated with
organizationIdstringThe Organization of the entity that the metadata is associated with; entities may have different metadata per organization
options?ObjectOptions (described below)

Options

ParameterTypeDescription
ignoreNotFound?booleanWhen the metadata does not exist: If true, return null; if false (default) throw an error

Returns

An error will be thrown if any of the arguments are invalid.

If the entity is not found, an error will be thrown with err.code equal to client.errors.NotFoundError.code.

Once the returned Promise is resolved, we will have access to a Metadata object.

Examples

try {
const metadata = await client.metadata.find(
'some-group-id', 'some-org-id'
);
console.log('found metadata', metadata);
} catch (err) {
if (err.code == client.errors.NotFoundError.code) {
console.log('Entity not found');
} else {
console.log('Error');
}
}