metadata.fullUpdate()

Adds/updates the Metadata for an existing Group or User entity.

This fully overwrites the entire metadata, and removes metadata keys which are not present in the entireData argument.

See client.metadata.update() for a variant which will only replace keys that are specified.

Definition

client.metadata.fullUpdate(
entityId: string|Group|User,
entireData: Object,
organizationId: string
):Promise<Metadata,Error>

Parameters

ParameterTypeDescription
entityIdstring|Group|UserThe entity that the metadata is associated with
entireDataObjectAn object which will entirely replace any existing metadata for the entity
organizationIdstringThe Organization of the entity that the metadata is associated with; entities may have different metadata per organization

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 the updated Metadata object.

Examples

try {
const entireData = await client.metadata.fullUpdate(
'some-group-id',
{ 'new_key': 'new_value' },
'some-org-id'
);
console.log('metadata for some-group-id is set to:', entireData);
} catch (err) {
if (err.code == client.errors.NotFoundError.code) {
console.log('Entity not found');
} else {
console.log('Error');
}
}