

@access.user
@loadmodel(model='item', level=AccessType.WRITE)
@filtermodel(model='item')
@describeRoute(Description('Set metadata fields on an item.').responseClass('Item').notes('Set metadata fields to null in order to delete them.').param('id', 'The ID of the item.', paramType='path').param('body', 'A JSON object containing the metadata keys to add', paramType='body').errorResponse('ID was invalid.').errorResponse('Invalid JSON passed in request body.').errorResponse('Metadata key name was invalid.').errorResponse('Write access was denied for the item.', 403))
def setMetadata(self, item, params):
    metadata = self.getBodyJson()
    for k in metadata:
        if (not len(k)):
            raise RestException('Key names must be at least one character long.')
        if (('.' in k) or (k[0] == '$')):
            raise RestException(('The key name %s must not contain a period or begin with a dollar sign.' % k))
    return self.model('item').setMetadata(item, metadata)

dataset/ETHPy150Open girder/girder/girder/api/v1/item.py Item.setMetadata/original