metadata.update()
Adds/updates the Metadata for an existing Group or User entity.
This only replaces metadata keys which are present in the partialData
argument.
See client.metadata.fullUpdate() for a version which will also erase keys that are not specified.
Definition
client.metadata.update(entityId: string|Group|User,partialData: Object,organizationId: string):Promise<Metadata,Error>
Parameters
Parameter | Type | Description |
---|---|---|
entityId | string |Group|User | The entity that the metadata is associated with |
partialData | Object | An object where each key in the existing metadata will have its value updated to match the value contained in the object |
organizationId | string | The 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.update('some-group-id',{ 'new_key': 'new_value' },'some-org-id');console.log('metadata for some-group-id updated and is now:', entireData);} catch (err) {if (err.code == client.errors.NotFoundError.code) {console.log('Entity not found');} else {console.log('Error');}}